Hi Joshua,
* Joshua Colson <[EMAIL PROTECTED]> wrote:
> Can someone help me, I need to retrieve files with spaces in them, and
> Net::FTP errors out everytime.
>
> I've tried embedding quotes, not storing name in variable, quoting/not
> quoting variables. I'm at a loss.
>
> I thought that maybe I could convert the spaces to something, much like a
> webserver converts spaces in a URL, but I don't know if a FTP server could
> handle that, or how to do it if it could.
I don't know how to convert spaces in file names on the server,
but what about using the dir method? You will get a long listing
format like "ls -l" does. Then parse the file names by an
appropriate RE.
an example:
-----------------------------------------
#!/usr/bin/perl -w
# file: ftp_test.pl
#
use strict;
use Net::FTP;
my ($ftp, $i);
my @listing = ();
$ftp = Net::FTP->new("localhost", Debug => 0);
$ftp->login("anonymous",'-anonymous@');
$ftp->cwd("/pub/testdir");
@listing = $ftp->dir;
foreach $i (@listing) {
if ( $i =~ s/.*(:[0-9]{2} )(.*)/$2/ ) {
print "$i\n";
}
}
$ftp->quit;
-----------------------------------------
My local server ist ProFTP on Linux, maybe other servers generate
other dir listings.
cu
christian
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]