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