Re: Unable to read timestamp for remote files
- From: "Paul Lalli" <mritty@xxxxxxxxx>
- Date: 10 Mar 2006 06:32:11 -0800
Alok Nath wrote:
When I try to retrieve the timestamp from a ftp folder I get
this error message :
>> Can't call method "mtime" on an undefined value at func.pl
line 69
but the same works in my local machine.
Of course it does. stat() looks for a file on your local machine.
My motive is to read the timestamp for each files in the remote folder.
Can somebody point out what is wrong exactly
What's wrong is that you're calling stat() on a filename that doesn't
exist on your local system. stat() has no way of knowing that the
filename you passed to it is actually representing a file on an FTP
server to which you happen to have an open connection.
or any alternative ??
Did you consider reading the documentation for the module you're using?
perldoc Net::FTP
<snip>
mdtm ( FILE )
Returns the modification time of the given file
<snip>
foreach ($ftp->ls($ftpDir)) {
print "file = $_\n" ;
$file_date = ctime(stat($_)->mtime);
my $file_date = $ftp->mdtm($_);
print "file $file updated at $file_date\n";
}
}
Paul Lalli
.
- References:
- Unable to read timestamp for remote files
- From: Alok Nath
- Unable to read timestamp for remote files
- Prev by Date: RE: XML Parsing error - regex problem?
- Next by Date: Re: parenthesis after a method
- Previous by thread: Unable to read timestamp for remote files
- Next by thread: Re: Unable to read timestamp for remote files
- Index(es):
Relevant Pages
|