Hi,
I need to fetch certain files from the server which has multiple subdirectories. How do i do it with NET FTP in Perl.
Example : \home\code\test and home\code\prod
I need to search for files under code (the file may be present in 'test' or 'prod') and get that file to local.
The code I used -
my $dir = "/home/code";
$f->cwd($dir) or die "Can't cwd to $dir\n";
$, = "\n";
my $fileto_get = "sample.sh";
$f->get($fileto_get) or die "Can't get $fileto_get from $dir\n";
This searches only in the specified directory 'code'. The file is present in 'tes't directory but it is not returned unless i change the directory to "/home/code/test".
Please guide me on how to fetch files, by mentioning only the parent directory.
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.