Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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"; }

Comment on Re: FTP - Download Multiple Files Matching Pattern
Download Code

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 having an uproarious good time at the Monastery: (4)
As of 2016-05-29 03:26 GMT
Find Nodes?
    Voting Booth?