Nancy Street

nrename

Click to see the Site Map
HomeInfoMusicGalleryPetsGeoHobbiesGeo
Site MapWhat's NewRecent ChangesContactsServer StatisticsSite Information Home « Computers « nrename

nrename is a command line utility that performs bulk file renames using regular expressions to pick piceces of the old names to reconstruct the new names. A good knowledge of regular expressions is required to use the command and care should be taken that it produces the required results. Use the /t switch to test the command before applying it to real files.

Here is the help display from nrename when no parameters are entered:

FUNCTION
Bulk file renamer using regular expressions. A knowledge of regex patterns
is required to use this command safely. The /t switch should be used to
test a bulk rename process to ensure the file name patterns and replacment
works correctly.
SYNTAX
nrename [ path ] patternFrom patternTo [ /s /v /t ]
PARAMETERS
path ............ The path to scan for files to rename, when omitted the
scan starts from the current directory.
patternFrom ..... Regex pattern to match for files to rename. Use ( ) to
define groups in the pattern that can be used to construct
to new file name.
patternTo ....... Regex pattern defining the new file name. Include {n}
tokens in the pattern to replace them with the 1-based nth
group matched in the patternFrom.
/s ............... Recursively scan for files.
/v ............... Verbose processing display.
/t ............... Test mode, no files are renamed.
EXAMPLE
nrename "^(\d+)\s+([\w ]+)\.(\w+)$" "{2} {1}.{3}" /s /t
Recursively scans the current directory in test mode for all files beginning
with digits followed by some blanks, then a simple file name with extension.
The new name has the digits moved from the front of the name to before the
extension. So for example, the file '123 My File.txt' would become
'MyFile 123.txt'.

A description of the regular expression syntax can be found at MSDN Introduction To Regular Expressions.

nrename Project - (7KB) ZIP of the Visual Studio .NET 2003 Project with source code
nrename Executable - (13KB) ZIP of the EXE file only

Back to: Computers & Software Main Page


Contact Information | PGP Keys | Site Map | What's New | Visitor Book
Last Updated: 06-Aug-2007 21:12
Copyright © 1999-2007 Orthogonal Programming