From: Colin McCabe Date: Mon, 15 Feb 2010 03:53:09 +0000 (-0800) Subject: Add dual_rename.sh to make ripping CDs easier X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc215edff3478210cf3ea4f35878e70d6df7b786;p=cmccabe-bin Add dual_rename.sh to make ripping CDs easier --- diff --git a/dual_rename.sh b/dual_rename.sh new file mode 100755 index 0000000..c28584c --- /dev/null +++ b/dual_rename.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +tmpfile=/tmp/$$.pid + +die() { + echo $@ + exit 1 +} + +cleanup() { + rm -f ${tmpfile} + exit +} + +# create temp file +trap cleanup INT TERM EXIT +cat > /tmp/$$.tmp + +# do lossless rename +dirname=`pwd | sed 's_.*/__'` +lossless_dirname="${dirname} [LL]" +pushd "../${lossless_dirname}" > /dev/null \ +|| die "couldn't change dir to ${lossless_dirname}" +bulk_rename.pl -f < /tmp/$$.tmp || die "bulk_rename -f failed" + +# do lossy rename +popd > /dev/null || die "failed popd" +bulk_rename.pl < /tmp/$$.tmp || die "bulk_rename failed"