Raise an error if file exists on destination

Henri Shustak henri.shustak at gmail.com
Thu Dec 15 03:18:35 MST 2011


> I am trying to use rsync to copy files from several origins to a single destination. I would like to detect when a file gets overwritten because it is present with the same relative path/name in several origins:
> 
> 
> Origin1:
> foo/bar.txt
> 
> Origin2:
> foo/bar.txt
> 
> Destination after copy:
> foo/bar.txt -> is that from Origin1 or origin2?
> 
> 
> I know I can use the `--ignore-existing` option to make sure only the first version is kept, or I could remove this option to keep the last one. But I would like to be notified when this happens, either with a warning or an error.
> 
> Is that possible with rsync?


The -i <--itemize-changes, output a change-summary for all updates> may do what you want.

However, my understanding for files which are detected to be the same in the source(s) and the destination will not be updated / overwritten. Perhaps someone else on the rsync mailing list may be able to clarify this point or answer your question more appropriately.


------------------------------------
 This email is protected by LBackup, 
 an rsync based, open source backup system
 designed for use with Mac OS X and GNU/Linux
 http://www.lbackup.org







More information about the rsync mailing list