--delete --force Won't Remove Directories With Dotnames

Matt McCutchen
2007-03-02T15:37:43Z

On 3/2/07, Sabahattin Gucukoglu <mail@sabahattin-gucukoglu.com>
wrote:
> --delete --force Won't Remove Directories With Dotnames
>
> if you remove a
> directory which was aborted in a recent transfer on source (leaving a
> .partial mirror at dest) the .partial directory won't go away on next
> rsync, ever.
>
> Example: rsync --partial-dir=.partial /foo /bar.  Abort the transfer, and
> /foo/biguns/bigfile gets left in /bar/foo/biguns/.partial/bigfile.  Now
> remove /foo/biguns and do the transfer again, to completion.  The
> /bar/foo/biguns/.partial/bigfile is still there.

Rsync is leaving .partial around because it's a partial dir, not
because its name begins with a dot.  As the explanation of
--partial-dir in the man page says, to get rsync to delete old partial
dirs, supply your own rule --filter='R .partial/' and use
--delete-after to avoid deleting partial dirs until after rsync has
gotten what it needs from them.

Maybe rsync should automatically delete a directory's partial dir when
it finishes processing files immediately in that directory.

Matt