3 Synchronize filename cases.
4 This script takes two arguments - first and second extensions to synchronize
7 There may be specified following options:
8 --verbose <== say everything what is going on
9 --recurse <== recurse subdirectories
10 --dummy <== do not perform actual renaming
12 Every such option can be specified with an optional "no" prefix to negate it.
14 Typically, it is invoked as:
15 perl sync-fnamescase.pl c obj --verbose
21 my ($ext1, $ext2) = map {quotemeta} grep {!/^--/} @ARGV;
29 (map {/^--([\-_\w]+)=(.*)$/} @ARGV), # --opt=smth
30 (map {/^no-?(.*)$/i?($1=>0):($_=>1)} map {/^--([\-_\w]+)$/} @ARGV), # --opt --no-opt --noopt
37 my @f = map {/^(.*)\.$ext1$/i} @t;
38 my %f = map {lc($_)=>$_} map {/^(.*)\.$ext2$/i} @t;
41 if (exists $f{$lc} and $f{$lc} ne $_) {
42 print STDERR "$sp$f{$lc}.$ext2 <==> $_.$ext1\n" if $opts{verbose};
44 print STDERR "ren $f{$lc}.$ext2 $_.$ext2\n";
47 system "ren $f{$lc}.$ext2 $_.$ext2";
52 for (grep {-d&&!/^\.\.?$/} @t) {
53 print STDERR "$sp\\$_\n" if $opts{'say-subdir'};