5 # Author : Chris Koeritz
6 # Rights : Copyright (C) 2002-$now by Author
9 # Replaces all of the matching endings on files in the current directory
10 # with a different ending. The first parameter should be the old ending and
11 # the second parameter should be the new ending.
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_suffix: requires two parameters--the old suffix to look for in this\n";
29 print "directory and the new suffix 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";
39 system("mv \"$filename\" \"$new_name\"");