Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move: add --leave-root to control --delete-empty-src-dirs behavior - fixes #7478 #7618

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nielash
Copy link
Collaborator

@nielash nielash commented Feb 6, 2024

What is the purpose of this change?

Before this change, it was not always possible to delete an empty source root directory during rclone move. Furthermore, the behavior was inconsistent based on whether the move was performed server-side or via the fallback to copy + delete.

After this change, a --leave-root flag is added to control whether --delete-empty-src- dirs deletes an empty src root. (It has no effect if --delete-empty-src-dirs=false or if the src root isn't empty.)

Note that --leave-root defaults to false, which is arguably a breaking change, although also arguably not, since the prior behavior was already inconsistent (the root was, in fact, still deleted for server-side moves without filters.) Defaulting to false also makes it consistent with the identical option in rclone rmdirs.

This setting should be particularly helpful for users wanting to rename a directory in place.

Note that both --delete-empty-src-dirs and --leave-root are effectively ignored for server-side directory move operations without filters, which always use the equivalent of --delete-empty-src-dirs=true --leave-root=false. (This is not a change, but was not previously documented.)

Was the change discussed in an issue or in the forum before?

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

…ixes rclone#7478

Before this change, it was not always possible to delete an empty source root
directory during `rclone move`. Furthermore, the behavior was inconsistent based
on whether the move was performed server-side or via the fallback to copy +
delete.

After this change, a --leave-root flag is added to control whether --delete-empty-src-
dirs deletes an empty src root. (It has no effect if --delete-empty-src-dirs=false or
if the src root isn't empty.)

Note that --leave-root defaults to false, which is arguably a breaking change,
although also arguably not, since the prior behavior was already inconsistent
(the root was, in fact, still deleted for server-side moves without filters.)
Defaulting to false also makes it consistent with the identical option in
`rclone rmdirs`.

This setting should be particularly helpful for users wanting to rename a
directory in place.

Note that both --delete-empty-src-dirs and --leave-root are effectively ignored for
server-side directory move operations without filters, which always use the
equivalent of --delete-empty-src-dirs=true --leave-root=false. (This is not a change,
but was not previously documented.)
@nielash nielash marked this pull request as ready for review February 6, 2024 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--delete-empty-src-dirs improvement on rclone move (--leave-root=false)
1 participant