The following works fine within the current folder, but I would like it to scan sub folders as well.
for file in *.mp3
do
echo $file
done
This works with most filenames (including spaces) but not newlines, tabs or double spaces.
find . -type f -name '*.mp3' | while read i; do
echo "$i"
done
This works with all filenames.
find . -type f -name '*.mp3' -print0 | while IFS= read -r -d '' i; do
echo "$i"
done
But if you only want to run one command you can use xargs
example:
find . -type f -name '*.mp3' -print0 | xargs -0 -l echo