CleanCode Perl Libraries |
Home | Perl | Java | PowerShell | C# | SQL | Index | Tools | Download | What's New |
Multi-Lingual Library | Maintainability | ||||||||||||
Perl | Java | JavaScript | Certified Class |
Testable Class |
Standalone Mode |
Diagnostic Enabled |
grouprename - Rename a group of files and optionally normalize sequence numbers.
usage: renameGroup [-s] [-d <digits>] <old prefix> <new prefix> <suffix>
-s show what would change; do not execute
-d digits normalize sequence numbers in names to specified digits
-h help
-H longer help (manual page)
Perl5.005, Getopt::Std, Pod::Usage
Renames a group of files in the current directory ending in the specified <suffix>, which may be a string or a regular expression (e.g. "htm" will match xx.htm but "htm.*" will match xx.htm or xx.html). The <old prefix> and <new prefix> are actually the entire basename of the file, not counting a sequence number. That is, if you have a series of files xx1.txt, xx25.txt, xx04.txt then you could change the xx to any other string. At the same time, you can normalize the sequence numbers to the same number of digits with the -d flag so they will sort numerically even though they are strings. Specifying "-d 3" on the above files, for example, would yield yy001.txt, yy025.txt, and yy004.txt.
Note that the current implementation does not work on files without some type of sequence number.
If you want a regular-expression based rename utility and are not concerned about sequence numbers, see Larry Wall's simple and elegant file name fixer in the Perl Cookbook.
None
Michael Sorens
$Revision: 8 $ $Date: 2006-12-19 21:13:43 -0800 (Tue, 19 Dec 2006) $
CleanCode 0.9.08
Home | Perl | Java | PowerShell | C# | SQL | Index | Tools | Download | What's New |
CleanCode Perl Libraries | Copyright © 2001-2013 Michael Sorens - Revised 2013.06.30 |