Skip to content

Instantly share code, notes, and snippets.

@michaellindman
Created July 24, 2017 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaellindman/2a3a819a7c9b206802306d0b7e7d9a19 to your computer and use it in GitHub Desktop.
Save michaellindman/2a3a819a7c9b206802306d0b7e7d9a19 to your computer and use it in GitHub Desktop.
convert wav files to flac
#!/bin/bash
# loop through files in currently active directory
for f in *.wav
do
# converts wav files to flac using sox
sox "$f" "${f%.*}".flac
shopt -s nullglob
#check for flac files in current directory
if [[ -n $(echo *.flac) ]]; then
# check if flac directory exists
if [ ! -d "flac" ]; then
# creates flac direcotry if it doesn't already exist
mkdir flac
fi
# move all flac files to the flac directory
mv *.flac flac/
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment