LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   net::ftp (https://www.linuxquestions.org/questions/programming-9/net-ftp-464963/)

innuendo_98 07-17-2006 03:29 PM

net::ftp
 
Anyone experienced with Net::Ftp ??

I'm trying to do a transfer, but there seems to be a problem in the $ftp->cwd();.

1. $ftp->ls() doesn't see the symbolic links, when using $ftp->dir() symbolic links will be shown.

Pretty much what I' trying to do is this, once I connect and change my directory in the ftp i gotta check if the directory where I want to transfer is a regular directory or a symbolic lynk. If its a symbolic link, I should just follow it and do the transfer.

Code:


$ftp = Net::FTP::Recursive->new($config{'host'}, isSymlink => 1, Debug => 1);
$ftp->login( $config{'user'}, $config{'pass'});
$ftp->cwd( $config{'trgt'});
my @listClients = $ftp->ls();
foreach $x (@listClients){
if (-l $x){
        print "Inside link test ".$x."\n";
        if (defined($clientLink = readlink($ftp->pwd()."/".$x))) {
                print "\t\t".$clientLink."\n";
                $ftp-> cwd( $clientLink );
                print $ftp->pwd();
        }
} else {
        $ftp->cwd( $client );
        }
}
$ftp->binary();                                        #Set Binary mode
$ftp->rput();
$ftp->quit;

Thanks in advance for any help.

chrism01 07-18-2006 11:17 PM

You might try these guys if you don't get an answer soon: http://www.perlmonks.com/


All times are GMT -5. The time now is 06:56 PM.