Ej wrote:
I have a similar problem. I need to download the same file every hour so it will be nice to be able to rename the downloads with a variable name.For example in this case: from ftplib import FTP ftp=FTP('tgftp.nws.noaa.gov') ftp.login() ftp.cwd('SL.us008001/DF.of/DC.radar/DS.81dpr/SI.kbuf') ftp.retrbinar('RETR sn.last', open('sn','wb').write) ftp.quit() Question: How to achive rename the downloaded files as sn1, sn2, sn3.... or with a timestamp?
you're downloading to the file name you pass to open ("sn" in your case), so to download to a different file, just pass in another name.
to rename an existing file on the local file system, use os.rename. </F> -- http://mail.python.org/mailman/listinfo/python-list
