Bug 10475 - Delete based upon enclosing folder
Delete based upon enclosing folder
Status: NEW
Product: rsync
Classification: Unclassified
Component: core
All All
: P5 enhancement
: ---
Assigned To: Wayne Davison
Rsync QA Contact
Depends on:
  Show dependency treegraph
Reported: 2014-02-27 20:13 UTC by Haravikk
Modified: 2014-02-27 20:13 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Haravikk 2014-02-27 20:13:44 UTC
I was happy to see the (fairly) recently added --delete-during, however I think it could be taken a step further.

I'd like to propose a --delete-outside flag, this would behave exactly as --delete-during does, however rather than postponing the deletions to the very end, they are instead performed when the directory they belong to is closed.

For example, while scanning a directory /foo rsync descends into a directory /foo/bar. Once inside it finds various files such as /foo/bar/a, /foo/bar/b etc. and also discovers some deletions such as /foo/bar/1 and /foo/bar/2. When it discovers these deletions they are queued up, as normal for --delete-during, however, they are deleted immediately after processing of /foo/bar is complete.

The advantages to this behaviour is that features such as --fuzzy, --partial-dir etc. will function normally as deletions don't occur early. However, once the to-be-deleted files are no longer required, they can be discarded. This removes the need for a backup to take place with enough free space leftover for deleted files plus any new ones (plus any in-transit ones). Basically instead of requiring enough free space for all to-be-deleted files, it is limited to only such files that are in any single directory.

I'm not sure about a name for the flag, --delete-outside doesn't seem very specific, maybe --delete-hierarchical? I'm not sure.