I have a directory with about 50 wav files that I need to convert to caf, because AudioServicesCreateSystemSoundID() returns an error for some of them (but not all).
Her
found this:
##
## Shell script to batch convert all files in a directory to caf sound format for iPhone
## Place this shell script a directory with sound files and run it: 'sh converttocaf.sh'
## Any comments to 'support@ezone.com'
##
for f in *; do
if [ "$f" != "converttocaf.sh" ]
then
/usr/bin/afconvert -f caff -d LEI16 "$f"
echo "$f converted"
fi
done
Customize the afconvert options then save it as a text file called 'converttocaf.sh', place it in the directory of files you want to convert and run it from Terminal.
It works with files with spaces in their names.