Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: FTP - Download Multiple Files Matching Pattern

by tokpela (Chaplain)
on Aug 17, 2009 at 11:07 UTC ( #789127=note: print w/replies, xml ) Need Help??

in reply to FTP - Download Multiple Files Matching Pattern

You need to download using a fullpath. Add the FTP directory to the filename before you can download it.

foreach(@files) { my $filename = $_; my $fullpath = "$ftpFolder/$filename"; # download the file if ($ftp->get($fullpath)) { # be sure to only delete the file if it successfully downloaded # then delete the file. if ($ftp->unlink($fullpath)) { print "DELETED FILE: [$filename]\n"; } else { print "[Error] UNABLE TO DELETE THE FILE: [$filename][" . $ftp->m +essage . "]\n"; } } else { # error - not able to download print "[Error] UNABLE TO DOWNLOAD FILE: [$filename][" . $ftp->messa +ge . "]\n"; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://789127]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2016-10-24 00:18 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (302 votes). Check out past polls.