2024/07/21 16:40:24 INFO : savestates/snes/Super Bomberman (USA).state.auto: Deleted
2024/07/21 16:40:25 INFO : savestates/snes/Super Bomberman (USA).state.auto.png: Deleted
2024/07/21 16:40:25 INFO : savestates/nes/Yoshi (USA).state.auto.png: Deleted
2024/07/21 16:40:25 INFO : savestates/gb/Alleyway (World).state.auto.png: Deleted
2024/07/21 16:40:25 INFO : savestates/nes/Zelda II - The Adventure of Link (USA).state.auto: Deleted
2024/07/21 16:40:25 INFO : savestates/gb/Alleyway (World).state.auto: Deleted
2024/07/21 16:40:25 INFO : nes/Zelda II - The Adventure of Link (USA).srm: Deleted
2024/07/21 16:40:25 INFO : savestates/nes/Yoshi (USA).state.auto: Deleted
2024/07/21 16:40:25 INFO : savestates/nes/Zelda II - The Adventure of Link (USA).state.auto.png: Deleted
2024/07/21 16:40:26 INFO : psx/Grand Theft Auto 2/Grand Theft Auto 2.srm: Deleted
2024/07/21 16:40:26 INFO : savestates/snes: Removing directory
2024/07/21 16:40:27 INFO : savestates/nes: Removing directory
2024/07/21 16:40:28 INFO : savestates/gb: Removing directory
2024/07/21 16:40:29 INFO : psx/Grand Theft Auto 2: Removing directory
2024/07/21 16:40:30 INFO : There was nothing to transfer
2024/07/21 16:40:30 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Checks: 10 / 10, 100%
Deleted: 10 (files), 4 (dirs), 218.540 KiB (freed)
Elapsed time: 8.1s
2024/07/21 16:40:30 INFO : Dropbox root 'GAMES': Committing uploads - please wait...
As expected, since I don't have the --create-empty-src-dirs flag, Folder 4 is not copied to the remote
As expected, Folder 5, File A, File B, File C, and File D are all removed for the remote because they are not present on the source
However, Folder 1, Folder 2, and Folder 3 remain on the remote after the sync. These directories are now empty, and I was expecting them to be removed.
Perhaps in the future there could be a --remove-empty-remote-dirs flag so that after running a sync like the above, the end result would be:
Yes, sorry, I should have said that the sync matched the structure I game in my example.
The unexpected behavior for me is just that the matching but empty directories remain on the remote. If it was a new sync, they wouldn't be transferred, and so I was expecting the end result of the test I did to be the same as if the initial root directory was empty, which would result in it remaining empty.
I may be the only one who would want a flag like --remove-empty-remote-dirs (or maybe it would be called --remove-empty-src-dirs), but that would help keep it clean on the remote when not using --create-empty-src-dirs.
I have a source directory.
The source directory is empty.
The destination already has that same source directory.
If that destination directory is already empty, rclone does nothing.
If that destination directory has anything, it'll be deleted but the directory remains.
So the source and destination match.
texter@Earls-Mac-mini test % rclone copy /etc/hosts GD:two/emptydir
texter@Earls-Mac-mini test % rclone sync one GD:two -vv
2024/07/22 19:52:39 DEBUG : rclone: Version "v1.66.0" starting with parameters ["rclone" "sync" "one" "GD:two" "-vv"]
2024/07/22 19:52:39 DEBUG : Creating backend with remote "one"
2024/07/22 19:52:39 DEBUG : Using config file from "/Users/texter/.config/rclone/rclone.conf"
2024/07/22 19:52:39 DEBUG : fs cache: renaming cache item "one" to be canonical "/Users/texter/Downloads/test/one"
2024/07/22 19:52:39 DEBUG : Creating backend with remote "GD:two"
2024/07/22 19:52:40 DEBUG : emptydir: Directory modification time the same (differ by -416.48µs, within tolerance 1ms)
2024/07/22 19:52:40 DEBUG : blah: Size and modification time the same (differ by -743.147µs, within tolerance 1ms)
2024/07/22 19:52:40 DEBUG : blah: Unchanged skipping
2024/07/22 19:52:40 DEBUG : Google drive root 'two': Waiting for checks to finish
2024/07/22 19:52:40 DEBUG : Google drive root 'two': Waiting for transfers to finish
2024/07/22 19:52:40 DEBUG : Waiting for deletions to finish
2024/07/22 19:52:40 INFO : emptydir/hosts: Deleted
2024/07/22 19:52:40 INFO : There was nothing to transfer
2024/07/22 19:52:40 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Checks: 2 / 2, 100%
Deleted: 1 (files), 0 (dirs)
Elapsed time: 0.8s
2024/07/22 19:52:40 DEBUG : 7 go routines active
and
texter@Earls-Mac-mini test % rclone lsf GD:two
blah
emptydir/
So you want something brand new that says if source directory is empty, delete the destination directory.
Not sure the use case for it, but feel free to put in a feature request.
Will do! The use case is limited, but related to some open source emulation projects where there are source directories for possible systems, with existing folders for each system upon install 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 the remote.
Makes sense. Text reads a little bit. Each person's use case is valuable and highly important to them as I just meant I couldn't think of one for me
I personally expect sync to sync 100% of the time and exactly match as that's what I am used to so back in the day when it didn't have a flag to create empty directories, that was strange to me.