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