I am using the Terminal on a Mac.
Per another question, I am doing
for i in ./01.\ Original\ Recording/*.m4a; do ffmpeg -i "$i" -b:a 64k ./02.\ Compressed/"$(basename $i)"; done
(as you can see, there are spaces in the directory names as well as in the filenames)
The output files are being put in the right directory (02.\ Compressed
).
Unfortunately, they come out named as 01.?Original?<Filename?With?Space>.m4a
(first part of directory name and rest of file name with spaces substituted by ?
)
I found that using the right combination of quotes worked.
for i in ./01.\ Original\ Recording/*.m4a; do ffmpeg -i "$i" -b:a 64k 02.\ Compressed/"$(basename "$i")"; done
That's quotes around the $(basename ...)
as well as around the $i
.
I initially though the inner quotes needed to be escaped - \"$i\"
- but that did not work and proved unnecessary