开发者

How can I use Net::FTP to get a file matching a pattern?

开发者 https://www.devze.com 2023-02-23 12:26 出处:网络
How can I use Net::FTP to get a file matching a pattern? Basically what I want to do is: $ftp->get(\"test*\"开发者_如何学C);

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"

0

精彩评论

暂无评论...
验证码 换一张
取 消