From c28e0bca3c88d7b9288397a9dc27f8a6e5b90c1a Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Tue, 30 Dec 2008 23:39:32 +0000 Subject: [PATCH] fix-names script to mess with track filenames Organization: Straylight/Edgeware From: Richard Kettlewell --- scripts/Makefile.am | 2 +- scripts/fix-names | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 scripts/fix-names diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 87eaf26..fe004d2 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -23,7 +23,7 @@ SEDFILES=setup teardown include ${top_srcdir}/scripts/sedfiles.make -EXTRA_DIST=htmlman sedfiles.make text2c oggrename make-unidata \ +EXTRA_DIST=htmlman sedfiles.make text2c oggrename make-unidata fix-names \ format-gcov-report make-version-string setup.in teardown.in macro-docs CLEANFILES=$(SEDFILES) diff --git a/scripts/fix-names b/scripts/fix-names new file mode 100755 index 0000000..97845d2 --- /dev/null +++ b/scripts/fix-names @@ -0,0 +1,22 @@ +#! /usr/bin/perl -w +use strict; + +my $act = 1; + +for my $f (@ARGV) { + if($f =~ /^-/) { + if($f eq '-n') { + $act = 0; + } else { + die "$0: unknown option: $f\n"; + } + next; + } + my $t = $f; + $t =~ s/[_ ]+/ /g; + $t =~ s/(?!(?<=\.)[A-Za-z0-9]+$)\b[a-z]/\U$&\E/g; + print "$f -> $t\n"; + if($act) { + (rename $f, $t) or die "$0: $f -> $t: $!\n"; + } +} -- [mdw]