Is this the correct usage of rmdirs?


#1

Hey folks,

I have the following script that moves files from a seedbox to my Google drive folder, but it leaves a number of empty directories that I need to remove by hand. I want to implement the rmdirs command and would like conformation that I am calling it correctly.

Cheers

#!/bin/bash
LOCKFILE="/var/lock/basename $0"

(
flock -n 9 || {
echo “$0 already running”
exit 1
}

/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/3D/ “gdrive:/The Skull/3D” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/4K_Film/ “gdrive:/The Skull/UHD Movies” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/4K_TV/ “gdrive:/The Skull/UHD TV_Shows” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/Anime/ “gdrive:/The Skull/Anime” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/Audio_Books/ “gdrive:/The Skull/Audio books” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/Books/ “gdrive:/The Skull/Books” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/Comics “gdrive:/The Skull/Complete” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/Film_Making/ “gdrive:/The Skull/Film Making” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/Game/ “gdrive:/The Skull/Game” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/Movie “gdrive:/The Skull/Complete” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/Music “gdrive:/The Skull/Complete” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/Software/ “gdrive:/The Skull/Software” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/Tutorials/ “gdrive:/The Skull/Tutorials” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/TV “gdrive:/The Skull/Complete” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
/media/dma/craftyclown/bin/rclone moveto ~/private/rtorrent/data/Complete/VR/ “gdrive:/The Skull/VR” -v --min-age 1m --log-file=/media/dma/craftyclown/rclone-upload.log --tpslimit 6
rclone rmdirs ~/private/rtorrent/data/Complete/ --leave-root
) 9>$LOCKFILE


#2

Yes that looks right


#3

Thanks Nick. I’ve run it as above but it doesn’t appear to make a difference. What might I be doing wrong?


#4

What are you expecting it to do that it isn’t?

Can you post the command with the -vv when you run it?