How to remove files at source present on destination without transferring them

David Liontooth lionteeth at
Sat Aug 18 03:47:22 MDT 2012

Does rsync provide a way to remove files at the source that are present 
on the destination, without first transferring the files?

I run the same task on several computers that copy the results to a 
server. Once the material is copied, it should be deleted at the source 
on all the machines.

Say A and B run the same task. A finishes first and copies the result to 
server C. When B finishes, the results are already present on C and B 
should just delete its results.

I thought I could use

    --remove-source-files   sender removes synchronized files (non-dir)
    --ignore-existing       skip updating files that exist on receiver

but in my tests, this only removes files after they have been 
synchronized from that machine.

In other words, in the scenario above when B issues

     rsync ~/job44 C:~/jobs/ -av --remove-source-files --ignore-existing

and all the job44 files are already present, these files (not the 
directory) should be removed on the source, but they are not.

 From the man page, it sounds like rsync has this functionality, but in 
practice it appears not to have it. Am I missing something or should I 
be using other flags?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the rsync mailing list