MRT: Multi renaming: From 1 to 3 digits, add zeros
Moderators: white, Hacker, petermad, Stefan2
-
- Junior Member
- Posts: 2
- Joined: 2020-07-16, 08:20 UTC
MRT: Multi renaming: From 1 to 3 digits, add zeros
My first go with Total Commander, som be easy with me.
I have more than 100 files that I have to rename for printing. Renaming file name is easy, also inserting correct date and month, but numbering troubles me.
My files are named [name][date][pagenumber]
My production today wil be named
GOFINPDT160720[pagenumer]
Pagenumbers (PDF) are 1, 2, 3, 10, 11 ...
Pagenumbers should be 001, 002, 010, 011 ...
So the final files will be names GOFINPDT160720001, GOFINPDT160720002, GOFINPDT160720003, GOFINPDT160720010, GOFINPDT160720011 ...
How do I change the pagenumber to 3 digits?
I have more than 100 files that I have to rename for printing. Renaming file name is easy, also inserting correct date and month, but numbering troubles me.
My files are named [name][date][pagenumber]
My production today wil be named
GOFINPDT160720[pagenumer]
Pagenumbers (PDF) are 1, 2, 3, 10, 11 ...
Pagenumbers should be 001, 002, 010, 011 ...
So the final files will be names GOFINPDT160720001, GOFINPDT160720002, GOFINPDT160720003, GOFINPDT160720010, GOFINPDT160720011 ...
How do I change the pagenumber to 3 digits?
- ghisler(Author)
- Site Admin
- Posts: 48199
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Multi renaming: From 1 digit to 3 digits
If the part "GOFINPDT160720" is fixed, you can use this:
GOFINPDT160720[C:3]
If the first part is different for some files but the length is fixed, you can use this:
[N1-14][C:3]
GOFINPDT160720[C:3]
If the first part is different for some files but the length is fixed, you can use this:
[N1-14][C:3]
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: Multi renaming: From 1 digit to 3 digits
Hi and welcome 2Torben Abildgaard
FROM:
GOFINPDT1607203
GOFINPDT16072011
GOFINPDT160720999
TO:
GOFINPDT160720003
GOFINPDT160720011
GOFINPDT160720999
Me think its hard to do without using an external script, like VBS, PowerShell or AutoHotkey?
(because you have to capture the individual numbers and add one or two or none additional zeros)
TC can support you by providing the selected files (or all, or whole folder) as arguments to such an script.
Maybe someone has a better idea...
If you need more help, just ask.
You could maybe use regular expressions in multirenametool for each of the two possibilities (one and two page number width)
Search: ^(.+?\d\d\d\d\d\d)(\d)$
Replace: $1 00 $2
Search: ^(.+?\d\d\d\d\d\d)(\d\d)$
Replace: $1 0 $2
Or smtg like that..
FROM:
GOFINPDT1607203
GOFINPDT16072011
GOFINPDT160720999
TO:
GOFINPDT160720003
GOFINPDT160720011
GOFINPDT160720999
Me think its hard to do without using an external script, like VBS, PowerShell or AutoHotkey?
(because you have to capture the individual numbers and add one or two or none additional zeros)
TC can support you by providing the selected files (or all, or whole folder) as arguments to such an script.
Maybe someone has a better idea...
If you need more help, just ask.
You could maybe use regular expressions in multirenametool for each of the two possibilities (one and two page number width)
Search: ^(.+?\d\d\d\d\d\d)(\d)$
Replace: $1 00 $2
Search: ^(.+?\d\d\d\d\d\d)(\d\d)$
Replace: $1 0 $2
Or smtg like that..
MRT: Multi renaming: Format 1 digit to 3 digits by adding leading zeros
OK, I tested now the RegEx,
and TC interprets the $1 + zero ("$10") as reference to the tenth sub-exepression. ($10$2)
[Up to 32 sub-expressions supported]
So add a sign between "$1" and "0" to keep or to remove afterwards, like an hashtag or an hyphen ($1#0$2) or ($1-0$2)
or escape the zero by adding an leading backslash "\" ($1\0$2)
FROM:
GOFINPDT1607203
GOFINPDT16072011
GOFINPDT160720999
TO:
GOFINPDT160720003
GOFINPDT160720011
GOFINPDT160720999
TRY:
- select all files
- start MultiRenameTool (MRT)
- Search for: ^(.+?\D\d{6})(\d)$
- [_]E [x]RegEx
- Replace with: $1\00$2
- Rename with [Start!]-button
- use the Reload button next to the [Start!]-button
- Search for: ^(.+?\D\d{6})(\d\d)$
- [_]E [x]RegEx
- Replace with: $1\0$2
- Rename with [Start!]
- OK, close
and TC interprets the $1 + zero ("$10") as reference to the tenth sub-exepression. ($10$2)
[Up to 32 sub-expressions supported]
So add a sign between "$1" and "0" to keep or to remove afterwards, like an hashtag or an hyphen ($1#0$2) or ($1-0$2)
or escape the zero by adding an leading backslash "\" ($1\0$2)
FROM:
GOFINPDT1607203
GOFINPDT16072011
GOFINPDT160720999
TO:
GOFINPDT160720003
GOFINPDT160720011
GOFINPDT160720999
TRY:
- select all files
- start MultiRenameTool (MRT)
- Search for: ^(.+?\D\d{6})(\d)$
- [_]E [x]RegEx
- Replace with: $1\00$2
- Rename with [Start!]-button
- use the Reload button next to the [Start!]-button
- Search for: ^(.+?\D\d{6})(\d\d)$
- [_]E [x]RegEx
- Replace with: $1\0$2
- Rename with [Start!]
- OK, close
-
- Junior Member
- Posts: 2
- Joined: 2020-07-16, 08:20 UTC
Re: Multi renaming: From 1 digit to 3 digits
I am happy. Points taken
Re: MRT: Multi renaming: From 1 to 3 digits, add zeros
copy all file names to txt,
modify name by vim using regular expression,
multi rename tools by load filenames
modify name by vim using regular expression,
multi rename tools by load filenames
Re: MRT: Multi renaming: From 1 to 3 digits, add zeros
How to do it the best way?
Why do you think vim is a standard Windows editor?
What regular expression should be used?
What is wrong with using regular expressions directly in MRT? It's been reported as successful.
Andrzej P. Wozniak
Polish subforum moderator
Polish subforum moderator
Re: MRT: Multi renaming: Format 1 digit to 3 digits by adding leading zeros
I only just saw this thread, but this I think a perfect example of why it would be so useful to allow multiple subsequent rename actions in a "macro".
Do one action results processed by action two results by action three etc.
In this case you would have two actions you can "play back" in one rename action.
Of course undo will be hard(er) if not impossible in some cases but that is the users risk, just slap a warning dialog in front of it
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)