|
© Matti Mattila, CPFA, CISA, CIA |
File Renaming Macro (ReNam1) |
|
Guidance worksheet
|

|
Picture 1 |

| |
Picture 2 |
|
- |
'ReNam1' exists in the same Excel workbook ('FilNam1.xls') as
'FilNam1' macro.
|
- |
There are pieces of information about the macro on 'Guidance' worksheet:
what the macro does, instructions for running the macro, and
information about the contents of a worksheet created in a run.
|
- |
'Guidance' worksheet is protected with a password against accidental overwriting and deleting.
The password is written in cell A16: 'suojaus'.
|
|
Results worksheets
|
- |
During each run a worksheet (results worksheet)
will be added into 'FilNam1.xls'.
Results of a run are shown and saved on it.
|
- |
You can delete a results worksheet; it does not harm running the macro.
|
|
Running the macro
|
- |
The easiest way to run the macro is pressing simultaneously Ctrl + Shift + 'r'
or clicking 'Run ReNam' button.
|
- |
The macro will ask to select a folder where to rename files (Picture 2).
Click 'Ok' to proceed.
|
- |
Brows to search a folder, and select it.
In picture 3 folder 'Test' will be selected.
Do not mind a message referring to file save in the browser window heading [1]:
no file will be saved in the folder during this phase.
|
- |
Next the macro shows the renaming form (picture 4).
If you do not submit any information, new file names will contain only a running number -
e.g. '000.jpg', '001.jpg' etc.
Prefix (here: '11 Apr Oslo_') will be added in front of it.
Any space in a prefix will be replaced with '_' (here: '11_Apr_Oslo_').
|
- |
You have a possibility to change file extention.
Need for this kind of change arises seldom [2].
Be careful when using the functionality: all the files will have same extention.
You write the desired extention in the box after 'Same extention to all (leave empty if not)'.
|
- |
As a default the macro renames files according to the alphabetical order of original file names.
|
|

| |

| |
Picture 3 | |
Picture 4 |
|
|
Should you want to rename the files in accordance of age of files in stead,
please, check 'According to Age of Files' [after 'Assignment of running Numbers'].
|
|
Results
|
- |
There is a example of a results worksheet in picture 5.
As we can see, spaces in the original file names have been replaced with '_'s.
|
- |
Explanations of the results table headings [of picture 5] can be read in picture 1.
|
|

| |
Picture 5 |
|
- |
There were spaces in the first two file names.
The spaces were replaced with '_'s,
and file names were changed accordingly.
Because of the change original file names are written in column 'OriNam' (cells 'D2:D3').
|
- |
Final renaming takes place when 'ZzDo.bat' is double-clicked.
Note, that there are no spaces in the new file names (picture 6),
although we had spaces in the desired prefix (picture 4).
|
- |
Double-clicking 'ZzRev.bat' reverses names back to those in column 'FilNam' in picture 5.
Reverse will not be perfect, if there were spaces in original file names.
|
- |
Would we need to get back the exact original file names,
we should remove '_'s [the spaces replaced by the macro]
manually [using the information in 'OriNam' column of the results table].
Automatic replacement of '_'s with spaces would change the original '_'s to spaces,too.
|
- |
Double-clicking 'ZzRev.bat' reverses names back to those in column 'FilNam' in picture 5.
Reverse will not be perfect, if there were spaces in original file names.
|
|
Download |
- |
You can download a workwork ('FilNam1D2.xls') containing macro 'ReNam1'
- as well as macro 'FilNam' - here.
|
- |
The demo version of the macro is valid till December 31, 2011.
After that date the macro runs only to give a message:
'Macro not valid anymore. Get new one: http://www.f-fs.net'.
However, a newer valid version of the macro available might be available here.
|
|
|
[1]
'Tallenna nimellä' in picture 3 is 'Save as' in English.
[2]
I have used this functionality in a preliminary step,
when making [with the help of self-made program] mass alteration of certan html code pieces
on pages of this site (http://www.f-fs.net).
Using the macro I created a 'bat' file for changing 'html' file names
to short file names with extension 'txt'.
|
|