Greetings Fellow Monks:
The goal here is to recursively download files from a directory tree. I have found that
Net::FTP::Recursive works quite well for the task. I have listed the cleared code below. I enabled debugging so that I can actually see what is going on, otherwise it just sits their and works but says nothing.
#!/usr/bin/perl -w
use strict;
use Net::FTP::Recursive;
my $ftp = Net::FTP::Recursive->new("ftp.domain.name", Debug => 1);
$ftp->login("anonymous",'scientist@site');
$ftp->cwd('/pub/files/');
$ftp->rget();
$ftp->quit;
The next step is to be able to exclude certain files that meet a regex pattern from being downloaded. According to the documentation this can be accomplished by including the parameter OmitAll into the rget() method. The documentation states that I give OmitAll a regex object. So let say we want to filter out files that contain a string "S1499" I implemented the following changes to the code(below) to no avail, can anyone point out perhaps what I am missing?
NEW CODE:
use strict;
use Net::FTP::Recursive;
my $ignore=qr/S1499/;
my $ftp = Net::FTP::Recursive->new("ftp.domain.name", Debug => 1);
$ftp->login("anonymous",'scientist@site');
$ftp->cwd('/pub/files/');
$ftp->rget([OmitAll => "$ignore"]);
$ftp->quit;
Any help and or insight is greatly appreciated!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.