How can I use Net::FTP to get a file matching a pattern?
How can I use Net::FTP
to get a file matching a pattern?
Basically what I want to do is:
$ftp->get("test*"开发者_如何学C);
Should match all files starting with test and do a get()
.
Thanks for any help!
Try this solution from perlmonks.org. Essentially do a remote ls, filter out what you don't want with grep
, then fetch the files.
$ftp->get($_) for grep /\.txt$/, $ftp->ls;
BTW, this took about 10 seconds to find with Google "net::FTP mget"
精彩评论