[Main topics] [Navigation]

Rename files by means of a table

The task
Creating the name table
Using the utility
Creating the graphic overview
Download the utility

[To top/bottom of page] The task

I want to create a graphic overview of the resource images from an executable file. It should look something linke this, but with the names of the resources as used within the program rather than just numbered.

There are good utilities to rename files according to rules, even based on regular expressions. My favorite tool in this area is MultiRen by Bruno Sonnino for PcMag.com. However, there are cases when no rules can be applied. This happens, for example, if you extract resources from an executable file. The single resource files are numbered and additionally you get a table for corresponding resource name and file name. Hence I need a utility which reads the given file names (for example, data_5.bin) and the resource names (P_ACCEPTALLCHANGE_18X18_R_D) and renames the files to new names with the correct extension (P_ACCEPTALLCHANGE_18X18_R_D.png).

The D+DD utility RenameByTable uses a table as input to rename files.

The table must have the format old_name » new_name. (» symbolises a TAB character):

Data_1.bin » P_ACCEPTALLCHANGE_18X18_N
Data_2.bin » P_ACCEPTALLCHANGE_18X18_N_D
Data_3.bin » P_ACCEPTALLCHANGE_18X18_R
Data_4.bin » P_ACCEPTALLCHANGE_18X18_R_D

Both old_name and new_name may have distinct extensions, but no content conversion is performed by the utility. Hence only 'compatible' file types should be renamed with this method:

Data_1.mif » reasonable-name.txt
Data_2.xml » toolbar-17.xml
win03.htm  » utility-one.html

For this rename method the "new destination" field must be left empty in the utility.

[To top/bottom of page] Creating the conversion table

For example, using ResHacker to extract the png resources with Action > Save [png] Resources, from FM-home\fminit\fmcustom.dll, you get 137 distinct resource files (*.bin) and a table file, which you might have named fmcustom.rc (the TAB character is visualized by » here):

P_ACCEPTCHANGE_18X18_N PNG»"Data_5.bin"
P_ACCEPTCHANGE_18X18_N_D PNG»"Data_6.bin"

For use of this table it must be modified to get the required format. A text editor allowing pattern matching (regular expressions) such as EditPad Pro is a handy tool for this task:

Search regex (.+) png "(.+)"
Replace  regex  \2\t\1

After this preparation the conversion table looks like this (» denotes a TAB).

Data_1.bin » P_ACCEPTALLCHANGE_18X18_N
Data_2.bin » P_ACCEPTALLCHANGE_18X18_N_D
Data_3.bin » P_ACCEPTALLCHANGE_18X18_R
Data_4.bin » P_ACCEPTALLCHANGE_18X18_R_D
And it can be fed into the utility.

[To top/bottom of page] Using the utility

The uitility allows to browse for the input and output files as well as to enter the file paths directly:

[To top/bottom of page] Creating the graphic overview

My graphic tool for albums of this kind is Thumbs Plus. I have defined a setup for 6 pictures in a row for A4 output. The result I get for the originally extracted resources can be seen at top of this page - neither a good sort (since numbering is not with leading zeroes), nore intuitve to use.

After renaming the creation of a graphic overview may create some problems, because resource names may be quite long. So do not throw away the renaming table, as there you find the full names. I had to change from 6 to 4 columns to cope with the long file names:

[To top/bottom of page] Getting the utility

The utility RenameByTable is freeware. Copy it from here. Of course no obligations included whatsoever … It is a compiled AHK script.

[Main topics] [Navigation]
 URL:  Created: 2009-07-27  Updated:
 © Docu+Design Daube, Zürich    
  Business of Docu + Design Daube Documentation issues Documentation issues Klaus Daube's personal opinions Guest(s) on this site Home of Docu + Design Daube To main page in this category To first page in series To previous page in series To next page in series To bottom of page To top of page search in this site Site map send e-mail to webmaster To bottom of page To top of page