perldoc Net::FTP:

 dir ( [ DIR ] )
         Get a directory listing of "DIR", or the current
         directory in long format.

         In an array context, returns a list of lines returned
         from the server. In a scalar context, returns a
         reference to a list.

so, for Solaris anyway:
# get file info
my @file_dir = $ftp->dir($file)
    or die "dir failed ", $ftp->message;
# looks like:
#  -rw-r--r--   1 10358    1          41392 Dec 26  2001 
01-C-684-C-12-18-01.pdf
# or (note time, not year:
#  -rw-r--r--   1 10358    1          41392 Apr 16  12:03 
01-C-684-C-12-18-01.pdf

foreach my $file ( @file_dir ) {
# split on whitespace for file_name
  my @file_parts = split(/\s+/, $file);
  my $file_name = pop(@file_parts);
  print "file: $file_name\n";
# er, other parts (id, gid, links) are guesses
  my ($perm, $id, $gid, $links, $size, @date) = @file_parts;
# fudge to handle both year and time
# use Date::Manip or something
  print "Date: ", join(" ", @date), "\n";
}

a

Andy Bach, Sys. Mangler
Internet: [EMAIL PROTECTED] 
VOICE: (608) 261-5738  FAX 264-5932

Why do programmers confuse Halloween and Christmas?
Because OCT 31 = DEC 25.
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to