From fc215edff3478210cf3ea4f35878e70d6df7b786 Mon Sep 17 00:00:00 2001 From: Colin McCabe Date: Sun, 14 Feb 2010 19:53:09 -0800 Subject: [PATCH] Add dual_rename.sh to make ripping CDs easier --- dual_rename.sh | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) create mode 100755 dual_rename.sh 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" -- 1.6.6.rc1.39.g9a42