I have a list of 15.000 documents where I need to remove a certain piece of text from the name.
The name structure is always: [xxx]_(xxx)_xxx.extension
I am trying to remove the (xxx)_
part of the filename. The length of xxx is variable.
I've only found ways to replace certain pieces of text or remove fixed pieces of text. Any help or guidelines are appreciated.
I would use JREN.BAT - a regular expression renaming utility. JREN.BAT is pure script (hybrid JScript/batch) that runs natively on any Windows machine from XP onward.
Assuming you have JREN.BAT in a folder that resides within your PATH, then all you need is the following command from the command line:
jren "^(\[.*?\]_)\(.*?\)_" "$1"
The command looks for file names in the current directory that begin with [*]_(*)_
and removes the (*)_
portion.
Use CALL JREN
if you put the command in a batch script.
You can add the /P
option to specify a path different than the current directory, and the /S
option to iterate all sub-directories.
You can use jren /??
to access the extensive documentation. Press <Enter>
to advance the help one line at a time, or <space>
to advance one screen page at a time. Or use jren /?
to get the entire help dumped to screen immediately.