Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP - getting file stats

Status
Not open for further replies.

cjac

Programmer
Joined
Dec 8, 2003
Messages
93
Location
GB
Does anyone know how to return file stats from an FTP session so that I can do a comparison on the original file size and the FTP'd file size? I have tried using 'stat' but ftp does not recognise this command? Here is what I've got so far which obviously does not work (fails on the ftp-> stat() line:
foreach (@files) {
$recv_name = $maindir.$outfile.$cnt.".cjj";
print "File $recv_name \n Press a key to continue\n";
getc;
if (/MYI/) {
print "\n Receiving file";
$ftp->get($_,$recv_name);
}
### Once received remove from the FTP server!
## But first validate the file size!!!
@filestat = stat($recv_name);
@filestft = $ftp->stat($_);
if ( -e $recv_name ) {
print "File exists. Check file size.";
}
if ( @filestat[11] = @filestft[11] ) {
$ftp->delete($_);
print "File Delete";

Any suggestions as how I could validate the ftp'd file with the one on the ftp server?
 
Under Net::FTP, size ( FILE ) would appear to be the way to go

HTH
--Paul
 
That seems to have done the trick. Cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top