I'm using the following shell script to loop through a text file, then delete anything that matches the filename there.
However, it does not work if the filename has spaces in it. How can this be rectified? Ideally my script will find and delete filenames with and without spaces....
Any other improvements to this most appreciated.
This is in OSX
Thanks for your ideas and suggestions in advance,
Dan
$ cat delete-files.sh
#!/bin/sh
PATH=/bin:/usr/bin:/usr/sbin
export PATH
for i in `cat /opt/scripts/files-to-delete.dat` ;
do find /Volumes/folder/subfolder -iname $i -print -delete ;
done
And the text file:
$ cat files-to-delete.dat
LloydsTSB_Customer_Identification.html
Santander_Update_Process.html
asdasdasd asdasdasd.txt