[Tutor] help with ftplib and file modification date
Rene Bourgoin
rb2.net at gmail.com
Mon Mar 16 23:27:28 CET 2009
i'm doing a simple upload to an FTP server using the ftplib module and
wanted to know how i can preserve the file modification date all the way
through the process. I lose the file mod date because i read the original
file then ftp writes a new file to the server which changes the mod dateto
the time and date of the file transfer.
Here is the basic code i used;
for file in os.listdir("C:\\dir"):
i=file # i catpures file
z="STOR " + i #STOR is upload command to FTP server
filename=open(i,'r')
f.storlines(z,filename) #FTP upload command
filename.close()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090316/279cb139/attachment.htm>
More information about the Tutor
mailing list