I have the following function to recursively find files, yet it does not work when there are spaces in the file names. What am I doing wrong here?
for f in "$(find "$1" -type f -name '*.*')"
do
echo "Processing $f file..."
done
I have the following function to recursively find files, yet it does not work when there are spaces in the file names. What am I doing wrong here?
for f in "$(find "$1" -type f -name '*.*')"
do
echo "Processing $f file..."
done
You have to tweak the IFS variable, as space is taken as a separator by default.
All explanations and different solutions can be found here. http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html