How to delete a whole destination tree (inclusive the destination its-self) with rsync (daemon)?

edacval at edacval at
Sun Oct 31 11:07:16 MDT 2010

On 10/31/2010 06:52 PM, Vahsen Beheer wrote:
> On 31-10-2010 17:23, Edvinas Valatka wrote:
>> Hi Vansen :) The 'p' in '-!pr' only needed, if directory 
>> remote-host::Backups/daily.20101030-0155 is not empty.
>> Workaround: rsync -d --del /tmp/empty-dir/ 
>> remote-host::Backups/daily.20101030-0155/ rsync -ndv -f '-!r 
>> /daily.20101030-0155' --del /tmp/empty_dir/ remote-host::Backups/
> Hi again Edvinas, and thanks a lot!!!
> I finally managed to delete a remote empty directory now! I 
> simplified my request a bit though, and need to delete a
> subdirectory of the module.
> Analogue to the above I tried:
> rsync -ndv -f '-!r /subdir/daily.20101030-0155' --del
> /tmp/empty_dir/ remote-host::Backups/subdir
> This however does not delete anything. What am i missing?

"-n" means "dry-run", no real action will be performed :).

Hope found one-line solution:
rsync -ndivv -f 'R /daily.20101030-0155/**' -f '-!r
/daily.20101030-0155' --del  /tmp/empty_dir/ remote-host::Backups/

More information about the rsync mailing list