M y    b r a i n    h u r t s  !                                           w e                 r e a l l y                 t h i n k                   w h a t                y o u             k n o w

27 March 2021

Bulk convert APE (MonkeyAudio) files to FLAC recursively from command line

A oneliner that will search recursively for all .APE files under the current folder (ie .) and convert them to .FLAC. This will handle correctly file names containing special characters such as single and double quotes, brackets, etc.
find . -type f -iname "*.ape" -exec sh -c 'ffmpeg -i "${1}" "${1%.*}.flac"' _ {} \;
In this way you can convert between any format that ffmpeg can handle, for exaple convert all FLAC files to MP3:
find . -type f -iname "*.flac" -exec sh -c 'ffmpeg -i "${1}" "${1%.*}.mp3"' _ {} \;