Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2017-07-26 16:40 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (398 votes). Check out past polls.