21); $ftp->login("login",'pass'); my @list = $ftp->ls(); chomp( @list ); foreach $i( @list ) ..."> 21); $ftp->login("login",'pass'); my @list = $ftp->ls(); chomp( @list ); foreach $i( @list ) ...">
 
Previous Thread
Next Thread
Print Thread
Rate Thread
#102619 04/19/2001 2:05 PM
Joined: Apr 2001
Posts: 8
Junior Member
Junior Member
Offline
Joined: Apr 2001
Posts: 8
use Net::FTP;

$ftp = Net::FTP->new("myhost.edu", Port => 21);
$ftp->login("login",'pass');

my @list = $ftp->ls();
chomp( @list );

foreach $i( @list ) {
my $mod_time = $ftp->mdtm( $i );

print $i . " - ${mod_time}n";
}


$ftp->quit;
##-------- Script ends here --------##

the mdtm call doesnt return anything for me... i checked the internet and other peeps were recieving a number(number of secs from jan 1970...)

why am i not getting anything?!?!?!

the list gives me this output:

dead.letter -
junk -
hello -
project -
www -
intra-www -


any help will be highly appreciated.
Thanks!

Sponsored Links
#102620 04/19/2001 9:17 PM
Joined: Aug 2000
Posts: 335
Member
Member
Offline
Joined: Aug 2000
Posts: 335
Hmmm ... I can't see anything wrong with your code.

You might try switching to binary mode with $ftp->binary(). On one FTP server I use, the size command only works in binary mode, not ASCII. (I know you're not using the size command here, but it's worth a try.)

Is it possible that that server doesn't support the mdtm command? I don't know if mdtm is a distinct FTP command, or if Net::FTP implements it some other way.

That last line could be written more simply as print "$i - $mod_timen";, although that shouldn't make any difference.

[ April 19, 2001 09:19 PM: Message edited by: Dave_L ]

#102621 04/20/2001 11:43 AM
Joined: Apr 2001
Posts: 8
Junior Member
Junior Member
Offline
Joined: Apr 2001
Posts: 8
my doupt was correct, i tried:

if ( $ftp->support( 'mdtm' ) ) {
print "Hooray!!! NO HAZZLE OF PARSING";
} else {
print "Pitty you, i'll have to write LIST parse code";
}

not neccesarily saying the output was:
Pitty you, i'll have to write LIST parse code.$

ah!, that is so bad, any one have already written code for parsing LIST output of the FTP command directory listing. ??

I have already started writing the parsing code, and it wouldnt be that difficult, but the only thing that bugs me is:
some FTP server uses the unix long listing format, and some use DOS long listing format!!!, thats bad for the programmers, as they will have to detect which listing format it is and than parse it correctly(hopefully) based on that.

Thanks any way wink


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,575
Posts293,932
Members13,824
Most Online6,139
Sep 21st, 2024
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,835
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2025 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)