FtpUpload

FtpUpload.py provides intelligent FTP uploading of files, using MD5 hashes to track which files have to be uploaded. Each upload is recorded in a local file so that the next upload can skip the file if its contents haven’t changed. File timestamps are ignored, allowing regenerated files to be properly uploaded only if their contents have changed.

Call setHost() and setMd5File() to establish the settings for a session, then upload() for each set of files to upload. If you want to have removed local files automatically delete the remote files, call deleteOldFiles() once, then finish() to perform the closing bookkeeping.

fu = FtpUpload()
fu.setHost('ftp.myhost.com', 'myusername', 'password')
fu.setMd5File('myhost.md5')
fu.upload(
    hostdir='www', src='.',
    text='*.html *.css', binary='*.gif *.jpg'
)
# more upload() calls can go here..
fu.deleteOldFiles()
fu.finish()

More documentation (but not much more!) is in the doc strings.

FtpUpload requires:

Download: FtpUpload.py

Comments

[gravatar]
It would be a good idea to replace '\\' by os.sep in ftpupload.py

Benjamin
[gravatar]
Yes, please do. The script as written will only work on Windows.
[gravatar]
Done! (I'm ashamed to say it, but I made the change shortly after Benjamin's original comment, but never bothered to put it up here...)

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.