I want to write a shellscript to convert all .ogg files in a directory to .mp3 files. The filenames contain spaces, so I use a lot of double quotes in the sequenco of commands. The command I use is
for FILE in "`ls -1 *.ogg`" ; do
ROOTFILE=`printf "%s\n" "$FILE" | sed "s/ogg//" `
ffmpeg -i "$FILE" "$ROOTFILE"mp3
done
But the all the filenames in the directory are now seen by ffmpeg as one string. How can I separate the individual filenames, while preserving the spaces in them?