5 # Author : Chris Koeritz
6 # Rights : Copyright (C) 2002-$now by Author
9 # Replaces all of the matching first portions of files in the current
10 # directory with a different chunk. The first parameter should be the old
11 # prefix and the second parameter should be the new prefix.
13 # This script is free software; you can redistribute it and/or modify it
14 # under the terms of the GNU General Public License as published by the Free
15 # Software Foundation; either version 2 of the License or (at your option)
16 # any later version. See "http://www.fsf.org/copyleft/gpl.html" for a copy
17 # of the License online. Please send any updates to "fred@gruntose.com".
20 require "filename_helper.pl";
22 local($first) = $ARGV[0];
23 local($second) = $ARGV[1];
25 #print "parms are: $first and $second \n";
27 if ( !length($first) || !length($second) ) {
28 print "change_prefix: requires two parameters--the old prefix to look for in this\n";
29 print "directory and the new prefix to replace the old suffix with.\n";
33 foreach $filename (&glob_list("./$first*")) {
34 local $new_name = $filename;
35 $new_name =~ s/$first/$second/g;
36 #print "old name $filename\n";
37 #print "new name will be $new_name\n";
38 system("mv \"$filename\" \"$new_name\"");