Automating FTP file transfers
Rene Pijlman
reply.in.the.newsgroup at my.address.is.invalid
Wed Nov 12 08:59:12 EST 2003
Limey Drink:
>is there any where I can search through archived newsgroup posts
http://groups.google.com
>I would like to know if the following could be made more robust using python
>and its FTP libraries rather than executing native OS commands in a shell
>script.
>
>Basically I need to... [upload a file]
Sure. Use ftplib. See
http://www.python.org/doc/2.3.2/lib/module-ftplib.html
Here's a code snippet from one of my scripts.
import os, ftplib
ftp = ftplib.FTP(Hostname,Username,Password)
ftp.cwd(WorkingDirectory)
ftp.storbinary("STOR " + RemoteZipFile, file(LocalZipFile, "rb"))
ftp.quit()
os.remove(LocalZipFile)
--
René Pijlman
More information about the Python-list
mailing list