开发者

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"

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜