libftp.size function gives wrong results!
Michael Davis
michael at damaru.com
Sun Jun 9 12:13:53 EDT 2002
Hi,
I just realized that this isn't a python question, it's an ftp question. I
tried doing:
size index.html
from the ftp prompt, and it too gave me the wrong size!
So I apologize for being off-topic. The trouble is, I can't seem to find a
newsgroup specific to ftp problems. The existing ftp newsgroups seem to be
just full of announcements about servers with adult content...
Cheers,
Michael
Michael Davis wrote:
> Hi,
>
> I'm writing a python program which will upload or download files via ftp.
> It's intended to be used to deploy a web site from a local machine to a
> server. It tries to determine which files are modified on the local
> machine by comparing file sizes and modification times.
>
> I try to compare files using os.stat for the local file and FTP.size for
> the remote. The problem is, FTP.size is giving me incorrect results. If I
> use the ftp command line client, and look at one of my files on the server
> (the output looks like 'ls -l') then I can see that the file size, is,
> say, 1200. But the FTP.size function returns, say, 1242. This happens for
> all the files, they're all reported to be about 5% larger than they really
> are.
>
> Is there a better way of doing this, aside from capturing the output of
> FTPLIB.dir (which goes to stdout) and parsing it?
>
> Thanks in advance!
--
Michael Davis
Damaru
Custom Programming - Web Development - Database Design
http://www.damaru.com
416-540-1284
More information about the Python-list
mailing list