X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sgf_rename;h=759380ce65da4bd4e27100dca6e6fd9927d45ef1;hb=881a2c98ccd186f8286a9c79d244b0958e5da5b4;hp=193a4349117d25d085035b95e808f5897090b8ad;hpb=5cff203dc76b1de91ed2f989e0e6b8f574c98083;p=bin.git diff --git a/sgf_rename b/sgf_rename index 193a434..759380c 100755 --- a/sgf_rename +++ b/sgf_rename @@ -22,8 +22,9 @@ for my $sgf (@ARGV) { } undef $fh; my $new_file = join('_', - map {s/\s+/_/g; - s/,//g; + map {s{/}{}g; + s/\s+/_/g; + s/,/_/g; s/[_-]+/_/g; s/^_//; s/_$//; @@ -34,6 +35,7 @@ for my $sgf (@ARGV) { @sgf{qw(PW WR DT RE)} ) ).'.sgf'; + print "Renaming $sgf to $new_file\n"; next if $sgf eq $new_file; warn "$new_file already exists" and next if -e $new_file; rename($sgf,$new_file);