5 # $RCSfile: rename,v $$Revision: 4.1 $$Date: 92/08/07 17:20:30 $
8 # Revision 4.1 92/08/07 17:20:30 lwall
11 # Revision 4.0 91/03/20 01:11:53 lwall
14 # Revision 3.0.1.2 90/08/09 03:17:57 lwall
15 # patch19: added man page for relink and rename
18 ($op = shift) || die "Usage: rename perlexpr [filenames]\n";
27 rename($was,$_) unless $was eq $_;
29 ##############################################################################
31 # These next few lines are legal in both Perl and nroff.
35 'di \" finish diversion--previous line must be blank
36 .nr nl 0-1 \" fake up transition to first page again
37 .nr % 0 \" start at page 1
38 ';<<'.ex'; #__END__ ############# From here on it's a standard manual page ############
39 .TH RENAME 1 "July 30, 1990"
42 rename \- renames multiple files
44 .B rename perlexpr [files]
47 renames the filenames supplied according to the rule specified as the
49 The argument is a Perl expression which is expected to modify the $_
50 string in Perl for at least some of the filenames specified.
51 If a given filename is not modified by the expression, it will not be
53 If no filenames are given on the command line, filenames will be read
56 For example, to rename all files matching *.bak to strip the extension,
60 rename 's/\e.bak$//' *.bak
63 To translate uppercase names to lower, you'd use
70 No environment variables are used.
79 If you give an invalid Perl expression you'll get a syntax error.
82 does not check for the existence of target filenames, so use with care.