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"
matgoldAsked:
Who is Participating?
 
gripeCommented:
The problem is with your FTP server.. you can't change this in the perl script. Your FTP server must be configured to show the actual owners of files as they are known to the windows server, if this is even possible. The output you are seeing is expected and normal.

What is the manufacturer/product name of the FTP server you (or the site you are connecting to) is using? It's possible that there is a configuration option to do what you want in the FTP server.

In the meantime, if this is a programming issue, perhaps there's another way to do what you want if you think about it a different way. What are you trying to do exactly? Why is the owner/group important in your script?
0
 
gripeCommented:
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.
0
 
TintinCommented:
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.
0
 
matgoldAuthor Commented:
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
0
 
matgoldAuthor Commented:
I just want to know, who is modifying/creating files.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.