diff --git a/README b/README index cb7f05d..2511eda 100644 --- a/README +++ b/README @@ -11,3 +11,4 @@ msc - short script to auto-resize mandoc output modem-manager - used to manage laptop PCIe WAN modems. rather dense netsh - an old experiment that serves as a simple TUI for managing network interfaces... and an example of how not to use AWK plumber - one of my more sophisticated scripts; plumber creates pipes between programs based on what sort of input it receives, and handles errors (somewhat) intelligently +bach - the Batch Audio Conversion Helper uses FFMPEG to convert large numbers of files at once diff --git a/bach b/bach new file mode 100755 index 0000000..699e697 --- /dev/null +++ b/bach @@ -0,0 +1,23 @@ +#!/bin/sh -e + +if [ $# -le 1 ] + then + printf "This script will take two variables and convert all audio files of the first format to the second, using ffmpeg. \n" +elif [ $# -ge 3 ] + then + printf "You've entered too many variables. We only need two... did you not check the help? \n" + else + i=`ls | grep $1 | wc -l` + p=1 + + mkdir $2 + + while [ $p -le $i ] + do + x=`ls | sed "$p!d"` + y=`printf "$x" | sed "s/$1/$2/"` + yes | ffmpeg -i "$x" "$y" + mv "$y" $2/ + p=$(( $p + 1 )) + done +fi