rclone / rclone/rclone

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

Open
#7,478 0 comments 9 reactions 0 assignees View on GitHub

@nielash is already working on this.

Since Feb 6, 2024.

  • #7618 by @nielash — open
enhancement
Dominant language
Go
Stars
59.8k
Forks
5.4k
Avg merge
2d 14h
Merged PRs (30d)
48

Description

The associated forum post URL from https://forum.rclone.org

https://forum.rclone.org/t/rclone-rcd-move-folder-doesnt-delete-empty-source-folder/15080

What is your current rclone version (output from rclone version)?

rclone v1.62.2

  • os/version: ubuntu 22.04 (64 bit)
  • os/kernel: 5.15.0-83-generic (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.20.2
  • go/linking: static
  • go/tags: none
What problem are you are trying to solve?

delete the root directory after completed move if the folder is empty. There will be some cases that can be left files when using filters.
rclone move /local/test/dir remote:bucket/test/dir
the folder /local/test/dir is leaved empty.

How do you think rclone should be changed to solve that?

just remove the root directory if the folder is empty. --leave-root=false flag as @ncw noted.

rclone move /local/test/dir remote:bucket/test/dir --no-traverse --fast-list --delete-empty-src-dirs --leave-root=false -v -P
Error: unknown flag: --leave-root
Usage:
  rclone move source:path dest:path [flags]

Flags:
      --create-empty-src-dirs   Create empty source dirs on destination after move
      --delete-empty-src-dirs   Delete empty source dirs after move
  -h, --help                    help for move

Use "rclone [command] --help" for more information about a command.
Use "rclone help flags" for to see the global flags.
Use "rclone help backends" for a list of supported services.

2023/12/01 17:20:06 Fatal error: unknown flag: --leave-root
How to use GitHub
  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The relevant entry point is the rclone move command and its --delete-empty-src-dirs handling; begin by reviewing the command's existing flags and linked pull request #7618. Done means an empty source root is removed when the requested leave-root=false behavior is used, including cases involving filters.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.