public
Created

Convert all files in directory to .WAV, with sequential numbering for file name

  • Download Gist
convert
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#!/bin/bash
FILES=*
DIR=converted
mkdir $DIR
let i=0
 
for f in $FILES
do
 
if [ $f != $DIR ] && [ $f != "convert" ]
then
 
#name=$DIR/$i-${f%\.*}.wav
 
if [ $i -lt 10 ]; then
name=$DIR/0$i.wav
else
name=$DIR/$i.wav
fi
 
echo "$f to $name"
afconvert -f WAVE -d LEI16@44100 -c 1 $f $name
let i++
fi
 
done

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.