chiark / gitweb /
Most of intro section
[disorder] / scripts / fix-names
CommitLineData
c28e0bca
RK
1#! /usr/bin/perl -w
2use strict;
3
4my $act = 1;
5
6for my $f (@ARGV) {
7 if($f =~ /^-/) {
8 if($f eq '-n') {
9 $act = 0;
10 } else {
11 die "$0: unknown option: $f\n";
12 }
13 next;
14 }
15 my $t = $f;
16 $t =~ s/[_ ]+/ /g;
17 $t =~ s/(?!(?<=\.)[A-Za-z0-9]+$)\b[a-z]/\U$&\E/g;
18 print "$f -> $t\n";
19 if($act) {
20 (rename $f, $t) or die "$0: $f -> $t: $!\n";
21 }
22}