Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Net::FTP->dir(

by amphiplex (Monk)
on Jul 17, 2002 at 15:09 UTC ( [id://182448]=note: print w/replies, xml ) Need Help??


in reply to Net::FTP->dir("abc def"); embedded spaces in filename fails.

Try using the ls() method, it worked for me connecting to a wuftpd on linux.

Looks as if dir() generates a LIST command, while ls() generates an NLST command. The former calls /bin/ls.

debug output:
Net::FTP=GLOB(0x8293290)<<< 220 central.node.at FTP server (Version 6. +5/OpenBSD, linux port 0.3.2) ready. Net::FTP=GLOB(0x8293290)>>> user kurt Net::FTP=GLOB(0x8293290)<<< 331 Password required for kurt. Net::FTP=GLOB(0x8293290)>>> PASS .... Net::FTP=GLOB(0x8293290)<<< 230- Have a lot of fun... Net::FTP=GLOB(0x8293290)<<< 230 User kurt logged in. Net::FTP=GLOB(0x8293290)>>> CWD /home/kurt/ Net::FTP=GLOB(0x8293290)<<< 250 CWD command successful. Net::FTP=GLOB(0x8293290)>>> PASV Net::FTP=GLOB(0x8293290)<<< 227 Entering Passive Mode (127,0,0,1,183,2 +25) Net::FTP=GLOB(0x8293290)>>> LIST test file Net::FTP=GLOB(0x8293290)<<< 150 Opening BINARY mode data connection fo +r '/bin/ls'. Net::FTP=GLOB(0x8293290)<<< 226 Transfer complete. DIR: [in.ftpd: file: No such file or directoryin.ftpd: test: No such f +ile or directory] Net::FTP=GLOB(0x8293290)>>> PASV Net::FTP=GLOB(0x8293290)<<< 227 Entering Passive Mode (127,0,0,1,183,2 +27) Net::FTP=GLOB(0x8293290)>>> NLST test file Net::FTP=GLOB(0x8293290)<<< 150 Opening BINARY mode data connection fo +r 'file list'. Net::FTP=GLOB(0x8293290)<<< 226 Transfer complete. LS: [test file]
generated by
$ftp = Net::FTP->new($destination, Debug=>2) || die "Couldn't connect: + $!\n"; $ftp->login($username,$password) || die "Couldn't log in: $!\n"; $ftp->cwd($path) || die "couldn't cwd! $!\n"; print STDERR "DIR: [",$ftp->dir($filename),"]\n"; print STDERR "LS: [",$ftp->ls($filename),"]\n";
--- amphiplex

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://182448]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-26 03:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found