Link to home
Start Free TrialLog in
Avatar of matgold
matgold

asked on

how do you get a full listing of files, using net:ftp

here are the script:

use Net::FTP;
$ftp = Net::FTP->new("$hname", Timeout => 30, Debug=>1)   ;
$ftp->login("$uname", "$pword")        ;
$ftp->cwd("$rdir")                     ;
$ftp->binary;
@dirlst = $ftp->pwd;
@filelst = $ftp->dir("*.csv");
print STDERR "","\n";
print STDERR @dirlst,"\n";
foreach $flist (@filelst) {
  print STDERR $flist,"\n";
  print STDERR "","\n";
}
$ftp->quit()


here are the output:

/reports
-r--r--r--   1 owner    group           49267 Aug 18 12:14 Retail.csv

-r--r--r--   1 owner    group           49267 Aug 18 12:33 Retail.csv



How do I show the owner of the file, the way it is now, it just say "owner"
Avatar of gripe
gripe

Is it possible that you're connecting to a windows-based FTP server or an FTP server that does not understand the concept of user/group in this context? Or an ftp server that simply assigns a generic owner/group name to all files?

Your code works as expected when I try it. The output you're seeing is coming from the server itself and is simply passed back by Net::FTP. Net::FTP does not modify the data that comes from a LIST command in any way, so the owner/group names you're seeing are coming from the server itself.

You can isolate the problem a bit more by connecting to the ftp site manually with the command line ftp program. (Usually /usr/bin/ftp on *NIX or C:\windows\system32\ftp.exe on windows) Try a dir command once connected and note the output. You should see the same owner/group names.
Avatar of Tintin
What did you expect the owner to be?

In your case the owner is 'owner' and the group is 'group'.  That is something set on the Unix server unless it is running a very, very strange FTP server.
Avatar of matgold

ASKER

yes, it is a windows-base FTP server.
I'm looking for an output, that looks like from dos command "dir /q"
Below is from dos command.

08/02/2004  11:30a             386 LROBERT    mansits_08022004.csv
ASKER CERTIFIED SOLUTION
Avatar of gripe
gripe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of matgold

ASKER

I just want to know, who is modifying/creating files.