RegExp - Rename as partial parent name

Hi guys,

I need some RegExp help...

I want to rename Clipboard Text.txt using the parent2 and parent folders but removing part of the text in parent and parent2.

For example, working in this folder.... C:\My Stuff[1234] Cats[9923] Dogs\

The following code:

Rename FILEINFO REGEXP "Clipboard Text.txt" TO "{parent2} ({parent}) - Filelist.ifl" me [1234] Cats ([9923] Dogs) - Filelist.ifl as expected.

I need to get rid of the square brackets and contents (which are always four number characters) so I end up with Cats (Dogs) - Filelist.ifl

Can anyone help me please?



You'll need a script for this. Attached is one you can use. Unzip it, import into your Rename dialog. Then, use the PRESET keyword of the Rename command to call it. For example:

Rename PRESET=blueroly (452 Bytes)

Alternatively, you can use my Dynamic Renamer with the command:

-sn -/.*/{parent2} ({parent1}) - Filelist.ifl/ -/\[\d+\]\s*//g

This does the following:

  1. removes the suffix

  2. replaces the entire filename with your desired file name, appending the parent dirs like you want
    -/.*/{parent2} ({parent1}) - Filelist.ifl/

  3. removes the bracketed digits including the brackets

The script file works perfectly, thanks MrC.

I will test at your Dynamic Renamer one looks impressive.

It is impressive!

Regards, AB