Just as another ‘alternative’ and not to replace the python script as it may be better and would be platform agnostic… but I use bash along with a rclone mount to accomplish this instead on linux. you’d have to run this multiple times depending on if you have empty directories nested in other empy directories (same as the python script).
-
Mount the rclone somewhere. I’m mounting on robacd: on /data/Media and then running below
-
Run this:
MNT=/data/Media
find $MNT -type d -empty | sed “s~$MNT~robacd:~” | tr ‘\n’ ‘\0’ | xargs -r -t -0 -n1 rclone -v rmdir
or with --dry-run
MNT=/data/Media
find $MNT -type d -empty | sed "s~$MNT~robacd:~" | tr '\n' '\0' | xargs -r -t -0 -n1 rclone --dry-run -v rmdir