Stupid Scripts

By Hal Canary, 2004-05-01 14:39:03 (link)
#computers-code

#!/usr/bin/perl
## ~/bin/prepend-something ##
my $pre = shift;
my @files = @ARGV;
foreach $file (@files) {
    my $new = $pre.$file;
    system ("mv -v \"$file\" \"$new\"");
}

 

#!/usr/bin/perl
## ~/bin/rename-files ##
my $old = shift;
my $new = shift;
my @files = @ARGV;
foreach $file (@files) {
    my $filenew = $file;
    $filenew =~ s/$old/$new/g;
    system ("mv -v \"$file\" \"$filenew\"");
}

(back)