amelinda has asked for the wisdom of the Perl Monks concerning the following question:
So, I just went and upgraded to a newer libnet in the hopes that it would handle filenames with spaces better. (As per Spaces in file names with Net::FTP) Unfortunately, I couldn't find any examples which showed -how- people made the newer Net::FTP work with spaces in filenames. Of course, I'm trying to build the filenames on the fly (with timestamps), instead of just a 'string filename'.
My current code is as follows:
my @type = ('farm\ &\ ranch', 'land', 'residential'); my $server = 'not.the.real.server.net'; my $c = Net::FTP->new($server); $c->login('username', 'password') or die "couldn't log in: $!\n"; for my $i (0..2) { $c->get("listings-$type[$i].txt.gz"); for my $j (0..6) { my $k = timestamp($j); $c->get("pics-$type[$i]-$k.tar"); } } $c->quit(); exit; sub timestamp() { my $days = shift @_; my @today = localtime(time - (86400 * $days)); $today[4]++; $today[5] += 1900; return sprintf("%04d%02d%02d", @today[5,4,3]); }
I'm sure that this could be written more tightly. I'm far more interested in 'working' than 'tight' right now, since this needs to be working before I leave for a week this evening.
I have verified that I am connected to the server, am logged in correctly, and can download the other files that don't have spaces in them. Someone's got to know... please help.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Net::FTP and filenames with spaces
by jlongino (Parson) on Feb 12, 2002 at 19:42 UTC | |
by amelinda (Friar) on Feb 12, 2002 at 19:50 UTC | |
by jlongino (Parson) on Feb 12, 2002 at 20:04 UTC | |
Re: Net::FTP and filenames with spaces
by amelinda (Friar) on Feb 12, 2002 at 19:44 UTC |
Back to
Seekers of Perl Wisdom