I have this bit of code:
find . ! -path . -type d -maxdepth 3 -mindepth 3 -exec sh -c '
dir="$0"
tvnamer --batch $dir
mv $dir/*.mkv $dir/..
[ -f $dir/*.part ] || trash $dir
' {} ';'
However, it breaks because there are spaces in directory names in $dir (TVnamer gets confused).
./Show/Season/[ www.Torrenting.com ] - Castle.2009.S06E01.720p.HDTV.X264-DIMENSION
./Show/Season/[ www.Torrenting.com ] - Revenge.S03E01.720p.HDTV.x264-2HD
How can I remove the spaces / rename the folders in $dir and then pass that to the rest of the code?