I'm trying to do transfer some files via Net::Ftp but I'm having problems with the symbolic links. The main problems resides in the $ftp->cwd(), looks like the $ftp doesn't see the symbolic links in he directory. If I use $ftp->ls(), it will only give me directories whereas when using $ftp->dir(), all of the contents of the directory (dirs and symlinks will be shown). The ide is to check if there is a symlink and when that happens follow the link and start the transfer or if its a directory simply change to that directory and transfer, here's the code I'm using when doing the transfer:
$ftp = Net::FTP::Recursive->new($config{'host'}, isSymlink => 1, Debug + => 1); $ftp->login( $config{'user'}, $config{'pass'}); $ftp->cwd( $config{'trgt'}); my @listClients = $ftp->dir(); 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(); $ftp->rput(); $ftp->quit;

2006-07-18 Retitled by Corion, as per Monastery guidelines
Original title: 'net::ftp'


In reply to transfering symlinks with Net::FTP by innuendo98

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.