Rename Files in the Current Directory

RENAME is a PERL script that can rename files in the current directory. A PERL code is used to describe the renaming operation, and the list of files to be renamed is given by a standard UNIX mask, such as "*.f" or "*" or "test?.dat".

Usage: code files
Example 1:

   'tr/A-Z/a-z/' *
will rename every file so that its name is lowercase.
Example 2:

   's/\.orig$//' *.orig
will, for every file that ends in ".orig", rename the file by removing the trailing ".orig".
Example 3:

   '$_ .= ".old"' *.cc
will append ".old" to the name of every file that ends in ".cc".


Larry Wall


  1. Tom Christiansen, Nathan Torkington,
    Chapter 9.9, Renaming Files,
    The Perl Coookbook,
    O'Reilly, 1999.

Source Code:

For "security" reasons, we seem to be unable to supply a file whose extension is "pl", so the Perl script has an extension of "perl". Source code files you may copy include:

You can go up one level to the PERL source codes.

Last revised on 06 March 2006.