ftplib - file.write, file.close() - verify finished writing locally before delete source?
If I want to verify that a file has finished writing before deleting the remote
file, what would be the best method?
Current code on Python 2.4:
#filename - remote FTP server File Name
#NewFile - local file copy of the remote file
#objFTP - standard ftplib.FTP object
NewFile = open(os.path.join(InputPath, RemoteFileName), "wb")
objFTP.retrbinary("RETR " + filename, NewFile.write)
#Here is my problem - when I call this directly after NewFile.close(), I end up
#with 0-byte local file and successfully delete the remote file.
Any ideas on how to keep the remote file from being deleted if the local file
isn't finished writing? Any ideas on why I might be retrieving a 0-byte file
locally when I call like this? If I remove the delete statement, it seems to
|All times are GMT. The time now is 05:56 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.