Based on my simple renaming macro posted yesterday in the "search and replace" conference I now wrote
FILE-REN.VDM -- An Extended File Renaming Utility
This utility lets you rename files using sophisticated search+replace expressions
The macro uses 'Regular Expressions', so you can't use the DOS/Windows wildcards here.
If you aren't familiar with that, please use VEDIT's online help (Topic "Regular expressions")
Example:
- Old name: test{.*}.txt
- New name: prod\1.doc
will rename all files beginning with 'test' and ending with '.txt' to 'prodxxx.doc'
where the 'xxx' is the appropriate part of the original name.
A button [Test] only lists the directory showing the planned renamings and reopens the dialog.
A button [Examples] opens a file with the following example expressions.
(That file is assumed to be in VEDITs user-macro directory.)
Since Regular Expressions may be a bit complicated it may help
to have some examples for usage with FILE-REN.VDM.
1) Renaming all .txt files to .doc files
Old name: {.*}.txt
New name: \1.doc
2) Renaming all .txt files to .doc files with additional name modification.
The leading text "test" should be renamed to "prod"
Old name: test{.*}.txt
New name: prod\1.doc
3) Files named like abc567.txt should be renamed to DATA-567.abc
Old name: {[a-z]+}{[0-9]+}.txt
New name: DATA-\2.\1
4) Add an additional digit to numbered files (Patrick Carroll's task)
Old name: {.* }{[0-9][0-9]}{[we]_}{.*}.jpg
New name: \10\2\3\4.jpg
Example:
IL03 016s 10w_001.jpg --> IL03 016s 010w_001.jpg
IL03 025n 015e_001.jpg (untouched)
Available here:
http://ziemski.privat.t-online.de/vedit/macros/file-ren.vdm
http://ziemski.privat.t-online.de/vedit/macros/file-ren.syn
http://ziemski.privat.t-online.de/vedit/macros/file-ren.txt
Christian