dwightschrute
Junior Member
- Jul 21, 2006
- 11
- 0
- 0
perl:
# Usage: rename perlexpr [files]
# eg on windows: rn.ple "s/searchfor/replacewith/" *
# in nix, you may need to use ' ' instead
use File::Glob qwglob); # needed if you want this to work on windows
use warnings;
($regexp = shift @ARGV) || die "Usage: eg on windows: rn.ple \"s/oldtext/newtext/\" * ";
if (!@ARGV) {
@ARGV = <STDIN>;
chomp(@ARGV);
}
foreach $_ (bsd_glob(@ARGV, GLOB_NOCASE)) {
$old_name = $_;
eval $regexp;
die $@ if $@;
rename($old_name, $_) unless $old_name eq $_;
print "$_\n" unless $old_name eq $_; # enable this if you want to see the renamed files listed
}
exit(0);
Originally posted by: Winchester
Hugs list. I use a ton of the programs mentioned in the list daily.
No reason for anyone to steal software anymore.