Anyone know of a clever way to remove no longer existing sub-directories while using ‘–max-depth 1’ ?
Currently I’m thinking of doing a ‘rclone sync --max-depth 1’ followed by listing and comparing the remote and local directories, then deleting the no long existing directories.
Does rclone rmdirs do what you want? That wil remove all the empty directories.
I think this would work:
- rclone sync --maxdepth 1 localdir remotedir
- get subdirs of remotedir
- get subdirs of localdir
- find remote subdirs which don’t exist locally (“subdirs of remotedir” - “subdirs of localdir”)
- rclone purge “remotedirs not local”