Dear Perl Monks,
I know I am being picky here and that I could just do two
ftp->dir's
twice and combine the arrays, but it is bugging me none the less.
I want to create an array that contains the contents of an ftp
directory. This is what it looks like in bash:
MyDocsBackup]$ ls -al backup1
total 12
-rw-r--r--. 1 matt users 0 Feb 5 22:06 .eraseme
-rw-r--r--. 1 matt users 0 Feb 5 22:11 eraseme2
drwxr-xr-x. 2 matt users 4096 Feb 5 22:19 eraseme.dir
-rw-r--r--. 1 matt users 0 Feb 5 22:16 eraseme.too
You will notice the first entry starts with a dot (".").
This catches the one with the starting dot:
my @TestArray = @{$ftp->dir ( "/$BkRoot/backup1/.*" )}
But not anything else.
These two catch everything else, but not the one with the dot:
my @TestArray = @{$ftp->dir ( "/$BkRoot/backup1/*" )}
my @TestArray = @{$ftp->dir ( "/$BkRoot/backup1" )}
Mumble, mumble. Is there a way to get
ftp->dir to give me
everything the first time?
Many thanks,
-T
This is what I have been using:
print "/$BkRoot/backup1 = \n";
my @TestArray = @{$ftp->dir ( "/$BkRoot/backup1/.*" )};
push ( @TestArray, @{$ftp->dir ( "/$BkRoot/backup1" )});
for ( @TestArray ) { print " $_\n"; }
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.