I found this answer to my question which uses the following code to remove words from file names using sed
:
for fyle in $(find . -name "*.*")
do
mv -i $fyle `echo $fyle | sed -e 's/FOO//gI' -e 's/BANG//gI' `
done
But on my mac it chokes on filenames whose paths have spaces.
I tried to fix it by use of double quotes, but couldn't get it to work: the variable fyle now includes the entire list of files, not one at a time.
Because the original poster seemed happy with the code, maybe my problem is because of my OSX flavour of bash?
How can I modify the code above to work well?