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