home::rsync

rsync rsync.py

This script mimics rsync which is available for the unix platform and have been ported to win32 one. It is a sort of advanced version of xcopy. Its aim is to selectively synchronize folders. More precisely it copy selective parts of a folder to a destination folder and in addition can remove parts of the destination folder that do not correspond to parts of the original folder.

I like its capability to avoid copying files through the .cvsignore mechanism or the pattern matching mechanism and its capability to delete files that are no longer relevant, not to mention that because it's a python script anyone can easily fix or improve it as he whish.

History

In the quest of a backup system, a way to mirror part of my disk to another disk I discover rsync. To have a Windows version not using the Cygwin dll and its folder and environment variables infrastructure that still confuse me I wrote rsync.py. The goal of rsync.py is to be roughly compatible with rsync, its unix counterpart.

News

29 December 2006 George Reilly added support for the '?' wildcar.

31 December 2005 Joshua Weage reported an incompatibility between rsync.py and rsync. If the --delete flag is on rsync.py was deleting files from the target folder that were not in the source folder or that were excluded from sync. The behavior of rsync and so the target behavior of rsync.py is to only delete files from the target folder that are not in the source and to delete the files excluded from sync only if the --delete-excluded flag is on. Furthermore rsync.py was deleting files from the source folder excluded from sync if the --delete-excluded flag was on when rsync never delete file from source folder. The new version 2.0.0 of rsync.py is compatible with the rsync behavior at least for the aspects. For the one that like the old behavior or that want to use the new version but do not want to change the behavior of they commands I have introduce a new flag --delete-from-source such that it is possible to get the old behavior although with a new set of flags. Follows a conversion table that should help to convert the old flags to the new ones.

old version new version
--delete --delete-excluded
--delete-excluded --delete-excluded --delete-from-source
--delete --delete-excluded --delete-excluded --delete-from-source

30 December 2004 Joshua Weage reported problems when rsync.py have to delete readonly folder or folder that contains other readonly files or folders. The new fixed 1.0.11 version solve this bug. It prepare the folder in the same it was preparing the file for deletion.

29 December 2004 Joshua Weage reported problems with sink of the kind "C:\". Actually rsync.py enter in a infinite loop with such sink. It prefere the equivalent "C:\.". The new fixed 1.0.10 version solve this bug.

6 November 2004 Luc Saffre reported an incompatiblity of rsync.py with its own doc and with rsync. Actually rsync.py was accepting the -t and --time flag instead of the -t and --times ones as written in its doc or as rsync. The new fixed 1.0.9 version will accept, for compatiblity reason, the -t, --times and --time flags.

8 September 2004 Marc Lenz reported that the combination of exclude pattern and delete flag did not delete the excluded file from the target. It was considered as a bug and solved in version 1.0.8.

6 July 2004 The current version should works with python 1.5.2. Messages and exception handling are improved.

2 July 2004 The compatibilty with older python version is improving, test on the unix platform are under way.

24 February 2004 With the aid of William Tan rsync.py now partly support unicode path and the support of rsync.py for unicode path should increase when python team slowly improves the unicode support of the python modules.

23 February 2004 Let rsync.py override hidden and system files (on win32 platform) and delete read only files.

19 February 2004 Willian Tan submit a patch to let rsync.py work with unicode path (As soon as I'am able to reproduce the problem I will integrate he's change in the code).

11 February 2004 When a file cannot be copied (because it cannot be read for example) rsync will skip it with a warning message instead of just quiting.

9 December 2002 We correct a bug on non recursive mode (when the sink was specified in absolute mode).

7 December 2002 We correct a bug on non recursive mode (the folder that match the sink argument where ignored).

7 December 2002 We correct a bug (rsync.py was only accepting the sinks of the kinds A1, C:A...A1, A...A1, A...A1, by opposition of the sinks C:A1, A1 that lead to failures).

15 November 2002 We correct a lot of bugs and make available a new version.

21 October 2002 The first release of rsync.py is available for download.

Documentation

The goal of the rsync.py script is to works as rsync as much as possible. There is some small differences and some feature that rsync.py do not yet support.

Differences:
  • the output is slightly different.
Unsuported features:
  • check sum,
  • permissions, ownership and groups,
  • cross file systemes operations,
  • ssh, authentification and encriptions.
Here is the list of supported flag of rsync.py:
-q, --quiet decrease verbosity
-r, --recursive
 recurse into directories
-R, --relative use relative path names
-u, --update update only (don't overwrite newer files)
-t, --times preserve times
-n, --dry-run show what would have been transferred
--existing only update files that already exist
--delete delete files that don't exist on the sending side
--delete-excluded
 also delete excluded files on the receiving side
--delete-from-source
 delete excluded files on the receiving side
-I, --ignore-times
 don't exclude files that match length and time
--size-only only use file size when determining if a file should be transferred
--modify-window=NUM
 timestamp window (seconds) for file match (default=2)
-C, --cvs-exclude
 auto ignore files in the same way CVS does
--exclude=PATTERN
 exclude files matching PATTERN
--exclude-from=FILE
 exclude patterns listed in FILE
--include=PATTERN
 don't exclude files matching PATTERN
--include-from=FILE
 don't exclude patterns listed in FILE
--version print version number
-h, --help show this help screen

Download

Here you can download the latest version of rsync.py. As rsync.py is a Python script you will need a python distribution to run it.

last update: 29/12/2006 09:57:54