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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why sizes are different???

Status
Not open for further replies.

suhaimi

Technical User
Aug 3, 2001
71
US
Hi all,
Why do I get 2 different sizes of the same file???
When I use ftp->dir("myfile.txt");
-rw-r--r-- 1 30002 1770156 Jul 31 18:15 myfile.txt
The size is 1770156

But when I use $mysize = ftp->size("myfile.txt");
$mysize is 1834155

Please help.
Suhaimi
 
I suspect ricgerdes is correct. $ftp->dir impliments a LIST FTP command. This often translates to an ls -al <file|dir> (or equivilent) on the ftp server side. That being the case it would be what ever the directory structure has recorded as the file size. $ftp->size impliments the SIZE FTP command. This request the server send the spzce allocated on the server for the file. Depending on the ftp server and underlying OS these can be two different things. LIST gets the info from the directory where as SIZE should be from the file itself.
 
I got it. I use ascii mode to transfer file. I should use binary mode instead.

rgds,
Suhaimi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top