#! /usr/bin/perl

$ctr = 0;
$f_go = 0;
if ( $ARGV[0] eq "-g" ) {
	$f_go = 1;
	print "go\n";
	$ctr++;
}
$FindStr = $ARGV[$ctr];
$NewStr  = $ARGV[$ctr+1];

@files = <*$FindStr*>;
#print "files = @files\n";

foreach (@files) {
	$newfilename = $_;
	$newfilename =~ s/$FindStr/$NewStr/;
	print "renaming $_ $newfilename\n";
	if ( $f_go ) {
		rename $_, $newfilename or print "     rename failed\n";
	}
}
