How to use rmdirs remove empty subdirectories only?

For example, I have empty subdirectories /a/b and /a/c. How can I prevent the root directory /a from being deleted after running rclone rmdirs remote:/a?

The easiest way us just to make it again afterwards with rclone mkdir remote:a or mkdir a if on the local FS.

Thought this question has been asked enough times that I should probably put a flag on rmdirs - --leave-root - if you please make a new issue on github then we can do that!

Thanks for the answer! My workaround for now is putting an empty file in the root directory so that running rmdirs won’t remove it. I will make a new issue on github soon.

1 Like