A Python script for synchronization of a remote directory structure from a local one via the FTP protocol.
Features
- Saves network bandwidth by uploading only those files that are modified
- Supports multiple servers with different content
- Supports alternative local directories allowing you to share the rc file between Unix and Windows
Download
- sitesync.py.
- Python source code
Changelog
12 Jan 2004
- Apply binary fix for Windows
5 Nov 2002
- Handle non-existing local directory or directories
27 Sep 2002
- Multiple ignore matches support (Note: Run control syntax change)
- Strip leading slash that was confusing some FTP servers
- Print number of ignored files
5 Aug 2002
- Run control file syntax change
- Re-ordering of files to upload first and then delete
- Support for FTP servers that don't set your home to /
1 Aug 2002
5 Jul 2002
- Rewrite of the code - it now handles almost all errors and every function is documented
25 Jun 2002
- Alternative local directories are available - the first that exists will be used, this allows sharing the same run control file between Linux and Windows
21 Jun 2002
- Added support for user break on long updates, all uploads will be marked
1 Jun 2002
- Fixed the non initialized filelist bug for multiple hosts
- The code is now Windows compatible, tested on Windows 2000
- One more change in the run control file, you are OK with the new version if you change /../ to *
14 Apr 2002
- Better handling of missing netrc file
16 Mar 2002
- Renamed to SiteSync
- Automatic local directory rescanning
2 Mar 2002
- Run config file syntax change
- Fixed change directory problem when the first file was in the root one
- Set all files to uploaded state option
- Print number of files that need uploading and deleting and do not connect to the server if both are zero
25 Feb 2002
- Full ~/.netrc write support
- Manual directory rescanning
- Delete files support
20 Feb 2002
- Added support for arbitrary level nested diretories
- Added create directory support, if it does not exist on the server
- Removed the rc-file password & username saving in favour of a ~/.netrc file
10 Jan 2002
Related Links
Bookmark/Search this post with:
Comments
RC file
Your script looks very promising. Can you make some sample .rc files available to help me out? BTW, I'll be trying this with binary files on Windows, so I can test for you. Thanks.
Great Script!
It works on windows for me.
Found the binary error
Hi,
you have to change this line:
self.ftp.storbinary('STOR ' + filename, open(self.local_dir + file, 'r'))
to this line:
self.ftp.storbinary('STOR ' + filename, open(self.local_dir + file, 'rb'))
to make it work on Windows (means: open the files in binary mode by appending the 'b').
Regards,
Dirk
ftp through proxy
Hi,
how can I upload a file behind a firewall/proxy??
Regads
x-herbert
file starting with dot
Hi,
for those who can find this useful: on my XP machine I need to rename in the script source .sitesync and .netrc into sitesync and netrc to get the script to work.
Regards
tBob