annotate bin/rmcrc @ 677:b95069a1f664

[irbrc] Disable autocomplete It's kinda slow and moves things around.
author nanaya <me@nanaya.pro>
date Fri, 08 Apr 2022 13:47:15 +0900
parents 66c32422a3d4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
1 #!/usr/bin/env perl
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
2
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
3 use warnings;
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
4 use strict;
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
5 use File::Basename;
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
6
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
7 my @files = @ARGV or print("Usage: ",basename($0)," file1 ... fileN\n") && exit(1);
116
66c32422a3d4 Forgot to enable.
Edho Prima Arief <edho@myconan.net>
parents: 115
diff changeset
8 my $skip=0;
88
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
9 foreach (@files) {
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
10 print(qq(Could not find file "$_", skipping\n)) and next() unless -e $_;
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
11 my $newname = $_;
115
7c3cdb235bbb The reverse of putcrc: rmcrc.
Edho Prima Arief <edho@myconan.net>
parents: 88
diff changeset
12 $newname =~ s/\[[[:xdigit:]]{8}\]//i;
7c3cdb235bbb The reverse of putcrc: rmcrc.
Edho Prima Arief <edho@myconan.net>
parents: 88
diff changeset
13 $newname =~ s/ *(\.\w+)$/$1/;
88
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
14 print(qq($_: $newname already exists, skipping\n)) and next() if -e $newname and $_ ne $newname;
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
15 if ($_ eq $newname) {
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
16 print("$_: no need to rename, skipping\n");
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
17 } else {
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
18 if($skip==1) { print("Result: $_ --> $newname\n"); }
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
19 else {
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
20 if(rename($_, $newname)) { print("$_ -> $newname\n"); }
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
21 else { print("$_: rename failed\n"); }
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
22 }
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
23 }
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
24 next();
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
25 }
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
26
917b525eaee0 Put [End] to files. Still in perl D:
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
27 exit(0);