Created
June 16, 2013 02:07
-
-
Save kitchen/5790466 to your computer and use it in GitHub Desktop.
uses avconv to convert .flac files to .alac. Is case-friendly and will skip files it has already converted. public domain where applicable. Come on, it's a 27 line bash script!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
downloaddir=$1 | |
if [[ -z "$downloaddir" ]]; then | |
echo "fatal, no arguments given" | |
exit 99 | |
fi | |
find "$downloaddir" -iname '*.flac' | while read flac; do | |
echo "found $flac" | |
dirname=`dirname "$flac"` | |
basename=`echo -n "$flac" | sed 's/\.flac$//i'` | |
basename=`basename "${basename}"` | |
fname="${dirname}/${basename}" | |
if ! [[ -f "${fname}.m4a" ]]; then | |
echo "alac "${fname}.m4a" doesn't exist, creating" | |
avconv -i "$flac" -acodec alac -- "${fname}.part.m4a" | |
if [[ "$?" -eq "0" ]]; then | |
mv -- "${fname}.part.m4a" "${fname}.m4a" | |
echo "success!" | |
else | |
echo "eek, something went awry: $?" | |
fi | |
else | |
echo "file was already converted, skipping" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use iDealshare VideoGo to batch convert FLAC to ALAC, it supports directly drag the FLAC forlder and then convert them at a time.
And it has both Mac version and Windows and also can convert FLAC to MP3, WAV, AIFF, AAC, WMA, and etc.
Step by step guide at http://www.idealshare.net/audio-converter/flac-to-apple-lossless.html