How to delete a whole destination tree (inclusive the destination its-self) with rsync (daemon)?
beheer at vahsen.nl
Sun Oct 31 12:16:41 MDT 2010
On 31-10-2010 18:41, edacval at gmail.com wrote:
> On 10/31/2010 07:26 PM, Vahsen Beheer wrote:
>> On 31-10-2010 18:07, edacval at gmail.com wrote:
>>> "-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/
>> :-) I know that it is a dry run... The thing is however that all your latter
>> solutions work perfectly on the root of the module.
>> However i need to delete directories which are in subdirectories of this module...
>> I guess the problem is the anchoring of the module in combination with the
>> Reading the manual about 'anchoring include/exclude patterns' and checking out
>> the filter-rules did not help me.
>> Can you get your last example to work with a subdirectory of a directory in the
>> module its-self ?
>> The thing i tried below (with the added "SUBDIR/") does not work:
>> ( i try to remove the tree: "remote-host::Backups/SUBDIR/daily.20101030-0155")
>> rsync -divvv -f 'R /*SUBDIR/*daily.20101030-0155/**' -f '-!r
>> /SUBDIR/daily.20101030-0155' --del /tmp/empty_dir/ remote-host::Backups/*SUBDIR/*
>> A final hint? ;)
> rsync -divvv -f 'R /daily.20101030-0155/**' -f '-!r
> /daily.20101030-0155' --del /tmp/empty_dir/ remote-host::Backups/SUBDIR/
The latter example of Edvinas works perfectly. It deletes the directory
It seems that filters are relative to the whole destination path, and
not only themodule (as for example '--link-dest' is).
Thanks a lot for your help Edvinas (and also Matt),
this seemed like a trivial thing to do, but certainly wasn't for a
More information about the rsync