GG has asked for the wisdom of the Perl Monks concerning the following question:

Hello, Iam using the Net::FTP module to connect to an Windows NT FTP Server, Serv-U. the problem is I cannot get a listing to work on this server, if I run the same script on a Unix Server all is well. Here is the specific line Iam using. @remotelist = $ftp->ls("-Al"); @remotelist returns nothing. I have tried using dir as well, but still no joy. Any ideas?

Replies are listed 'Best First'.
Re: Net::FTP Help
by Dog and Pony (Priest) on Feb 25, 2002 at 10:19 UTC
    Have you tried $ftp->ls() without the UNIX-specific parameters "-Al"?

    $ftp->ls expects a directory as the argument, or when empty, will list current directory. That you can use command line swithes could be called a bug, or a feature, depending on who you ask. :) Point is, that the UNIX ftp server either asks the shell for ls "whatever you said", or is aware of such switches. (That is, of course, assuming that you have those switches for a reason, and that they produce different results?) Serv-U most likely isn't, although you could, for fun, try to enter Windows/DOS-specific switches and see what happens.


    You have moved into a dark place.
    It is pitch black. You are likely to be eaten by a grue.
Re: Net::FTP Help
by derby (Abbot) on Feb 25, 2002 at 13:34 UTC
    GG,

    besides the excellent suggestion by Dog and Pony, you should consider if you need to use "passive" mode ftp. If there's a firewall between your client and your FTP Server, there may be some rules which disallow the FTP Server from opening the data connection and sending data. Hence the need for passive mode. Do you run the same script on a Unix Server to the NT FTP server or the same script on the same client to a UNIX FTP server? If it's the former (Unix to NT FTP server), the FTP_PASSIVE environment variable may be set in which case Net::FTP will work appropriately. You don't show the code but is the ls not returning anything or failing? Most passive ftp problems will show up as a long lag time when trying to retrieve from or list on the FTP server. Appropriate error checking should point you in the right direction.

    -derby