Created attachment 6932 [details] patch to skip open files Add an option to skip files that are open on the sender. use case is where syncing a directory with --remove-source-files and a prior patch I've written, for rename existing. It causes rsync to skip files on the sender that are open. Tested where cygwin/Windows is the sender. Not tested on other systems.
Created attachment 6950 [details] second version of patch Second version of the patch. I should note this is a very cygwin specific patch, and designed as such. I'd be surprised if this is of any value on a Unix/Linux system. Nevertheless, it does what we need, and I've seen some google requests for it, so it is contributed back. I wouldn't expect it to hit mainline rsync. Basically, in cygwin, if a file is not-unlinkable, then a freshly created link() to that file is equally un-linkable. This patch sets up a directory (.rsync-tmp) and prior to processing any file creates a link(), then attempts an unlink(). If anything fails, it skips. Linux does not exhibit this behavior. Also, for extra safety, it performs a flock() to get an exclusive lock, then immediately unlocks. Thanks, Devin