Feature request: add flag to remove empty source directories present on remote

One example of this comes from open-source emulation projects where there are source directories for possible systems, with existing folders for each system upon installation of the OS. The user then puts the correct files into the corresponding directory. This ensures that the directory structure of the source that files are being sorted into is consistent for all users.

When backing up files to a remote via rclone sync, it can leave orphaned directories on the remote. These empty directories can build up over time, and it forces the user to have empty directories in their backup. The issue for the user is that they have additional directories to traverse when looking for something and general clutter.

Ideally, if the states change to a point where a non-empty source directory has been copied to the remote and then the source directory later becomes empty, the remote directory would be deleted as well. This would ensure that this flow matches what would happen if a source directory is empty when running rclone sync without the --create-empty-src-dirs flag so that an empty source directory is not present on the remote.

One possible solution could be to have a --remove-empty-src-dirs flag.

It is possible with current version of rclone but requires extra step.

After your sync run rclone rmdirs which does exactly that - recursively removes any empty directories (including directories that only contain empty directories), that it finds under the path.

Have a look at docs:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.