hi guys i have a problem with this code:
for dir in ~/Documents/CMDsh/*/ # list directories in the form "/tmp/dirname/"
do
countFolder=$((countFolder+1));
#echo $dir; #res: /home/arutosio/Documents/CMDsh/20060 Little Non - Hanamaru Sensation (TV Size)/
dir=${dir%*/};#remove the trailing "/" #res: /home/arutosio/Documents/CMDsh/20060 Little Non - Hanamaru Sensation (TV Size)
nameFolder=${dir##*/}; #print everything after the final "/" #res: 20060 Little Non - Hanamaru Sensation (TV Size)
pathNameFolder="$(echo $nameFolder | sed 's/ /\\ /g')"; #res: 20060\ Little\ Non\ -\ Hanamaru\ Sensation\ (TV\ Size)
pathNameFolder="$(echo $pathNameFolder | sed 's/(/\\(/g')"; #res: 20060\ Little\ Non\ -\ Hanamaru\ Sensation\ \(TV\ Size)
pathNameFolder="$(echo $pathNameFolder | sed 's/)/\\)/g')"; #res: 20060\ Little\ Non\ -\ Hanamaru\ Sensation\ \(TV\ Size\)
echo "NumFolder: $countFolder Creating... \"$nameFolder.osz\""; # print everything after the final "/"
echo "zip -r -j -9 ~/osuLazerBeatmap/$pathNameFolder.zip $pathNameFolder/*"; #res: >
#zip -r -j -9 ~/osuLazerBeatmap/20060\ Little\ Non\ -\ Hanamaru\ Sensation\ \(TV\ Size\).zip 20060\ Little\ Non\ -\ Hanamaru\ Sensation\ \(TV\ Size\)/*
zip -r -j -9 ~/osuLazerBeatmap/$pathNameFolder.zip $pathNameFolder/*;
echo '------------------------------';
done
but when i run my sh this line:
zip -r -j -9 ~/osuLazerBeatmap/$pathNameFolder.zip $pathNameFolder/*;
make this error: zip error: Invalid command arguments (short option '\' not supported) i tried to run a the result of this line in my terminal and it is working: zip -r -j -9 ~/osuLazerBeatmap/20060\ Little\ Non\ -\ Hanamaru\ Sensation\ (TV\ Size).zip 20060\ Little\ Non\ -\ Hanamaru\ Sensation\ (TV\ Size)/*