I am trying to remove a set of multiple zipped directories in BASH. These directories have spaces between them, so when I try to delete them, they interfere with the spaces.
I have tried removing the directories by using a for loop.
direc=`ls -d *.zip`
for eachDir in $direc
do
echo $eachDir
rm -r $eachDir
done
Each word in my directory name is being treated as a seperate directory (because of the spaces) which causes an error in deleting the zipped file.
I have also tried using:
FILES=$(find . -name "*.zip")
for val in $FILES
do
echo $val
done
From both these pieces of code, my result is the same
As seen from the photos, "Whos" "Wants" and "To"... are all seen as seperate files as space is causing this. How can I fix this?