Converting a directory of wav files to flac

Posted on: 2020-02-22 Last edited: 2020-02-22
  • English

I recently had an ad hoc requirement to convert a dictionary of of wav files to flac. The wav files located inside multiple levels of sub directories.

After some digging online and trial-and-error, I had something working:

find . -depth -iname "*.wav" -exec sh -c 'ffmpeg -i "$1" "${1%.wav}.flac"'

And to delete the wav files:

find . -depth -iname "*.wav" -exec sh -c 'rm "$1"' _ {} \;