file rename using lookup table?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
nn1k3
Member
Member
Posts: 136
Joined: 2007-02-06, 16:59 UTC

file rename using lookup table?

Post by *nn1k3 »

Suppose I have a long list of files that I wish to rename. The present filenames happen to equal the time of downloading T. I have a lookup table with 2 columns: the present filename T and the corresponding desired filename Y.

With Multi-rename tool I can Search for T1 and Replace with Y1 but that changes only one file. Suggestions welcome.

Code: Select all

Original  Desired
T1        Y1
T2        Y2
...
Tn        Yn
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

From Help for MRT:

"... Load names from file: Specify a text file from which the new names should be loaded ..."

http://rgho.st/6pFcTyvNs
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
User avatar
nn1k3
Member
Member
Posts: 136
Joined: 2007-02-06, 16:59 UTC

Post by *nn1k3 »

Thank you for pointing me to "Help" which is quite clear.
User avatar
Stefan2
Power Member
Power Member
Posts: 4159
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

"Load names from file" loads only a list of names to rename in the same order as the files listed in MRT.

So the names in the text file must have the exactly same order as the files listed in MRT.

nn1k3 may need a 1:1, OldName=NewName relation ship,
no matter which order the listed files have?
That would look like an task for a scripting language, not for MRT:
-- read in the file with the lookup table
-- split on each line
-- skip [1] header line
-- split each line at,... at what sign?,... at TAB?
-- Rename Original to Desired.

We mostly utilize here VBScript, AutoHotkey and PowerShell.
DOS-Batch too, but its intricately.



 
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Post by *Ovg »

I don't see problem here - OP can sort file with names by names and remove column with original names. :idea:
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
User avatar
Stefan2
Power Member
Power Member
Posts: 4159
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

You mean, names in MRT are sorted anyway, and sorted 'lookup table' by Original column
(which would be removed after sorting for the "Load names from file" task),
would guarantee the wanted Old=New relationship?


Well, if both list have the same amount of entries and no files are missed in between:

Code: Select all

MRT 
Old name New name
T1         Y1
T4         Y2
T5         Y3
T6         Y4


lookup table 
Original  Desired
T1        Y1
T2        Y2
T3        Y3
T4        Y4
...
then that can work too. Would be too dangerous for me to overlook mistakes.


It always depends... :wink:



 
User avatar
nn1k3
Member
Member
Posts: 136
Joined: 2007-02-06, 16:59 UTC

Post by *nn1k3 »

Thank you for your thoughts. I am content now with this simple method:
  • 1.. Sort the original files in some order using TC. Select the files you want to rename.
    2. Alt+M+Y to copy those file names. Paste into column A in a spreadsheet. Carefully populate column B with your desired new names. Paste column B into a text file, say, NewNames.txt.
    3. Go back to TC. Ctrl-M Multi-Rename Tool lists the selected filenames in the same order as in TC. (Do not change the order in MRT by clicking on a header)
    4. "Load names from file" and select NewNames.txt.
    5. Pause to check that the "new names" look right in MRT before clickng on "Start!"
Although your spreadsheet is a lookup table, NewNames.tx is not. The renaming is based only on the order of the files. The 3rd file in TC will be given the 3rd name in NewNames.txt.
Post Reply