[Feature request] Reset counter when change folders in batch rename mode

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Troy_Daniel
Junior Member
Junior Member
Posts: 14
Joined: 2021-04-30, 14:14 UTC

[Feature request] Reset counter when change folders in batch rename mode

Post by *Troy_Daniel »

I don't known whether there is a way to reset the counter in batch rename, when the files changes from one folder to another. For example, given the original file list as:

CommonParent/folderA/file1.txt
CommonParent/folderA/file2.txt
CommonParent/folderA/file3.txt
CommonParent/folderB/file1.txt
CommonParent/folderB/file2.txt
CommonParent/folderB/file3.txt

I want to rename the text files within the CommanParent (and the subfolders) to

CommonParent/folderA/Another-name-0001.txt
CommonParent/folderA/Another-name-0002.txt
CommonParent/folderA/Another-name-0003.txt
CommonParent/folderB/Another-name-0001.txt
CommonParent/folderB/Another-name-0002.txt
CommonParent/folderB/Another-name-0003.txt

If with counter-reset option R, I can first flatten the folder (Ctrl+B, cm_DirBranch), select all the files ane batch rename them with option: Another-name-[C:04R]. However, I cannot find a suitable way to do this, except rename the files in folderA/B seperately or import files (with vim, it's quite easy), which is not a good idea for a large quantity of folders.

For the standalone prgram "renamer", there are options for a counter like: (the 2nd is quite useful)
1. Reset every: n times
2. Reset if folder changes
3. Reset if file name changes

Any ideas will be appreciated. Thanks in advance.
User avatar
petermad
Power Member
Power Member
Posts: 14743
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [Feature request] Reset counter when change folders in batch rename mode

Post by *petermad »

2Troy_Daniel
This thread basicalley handles the same problem viewtopic.php?p=405857#p405857 - here I give a solution using cmd.exe without flattening the folder first. But if you often has to use it with different Another-name- it can be tedious to change the code of the script each time.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Troy_Daniel
Junior Member
Junior Member
Posts: 14
Joined: 2021-04-30, 14:14 UTC

Re: [Feature request] Reset counter when change folders in batch rename mode

Post by *Troy_Daniel »

petermad wrote: 2021-10-29, 20:14 UTC 2Troy_Daniel
This thread basicalley handles the same problem viewtopic.php?p=405857#p405857 - here I give a solution using cmd.exe without flattening the folder first. But if you often has to use it with different Another-name- it can be tedious to change the code of the script each time.
Thanks for replying.
It is not sutiable for the case: [N][C:5R] (if R option provided).

BTW:The script can be improved by prompting for base filenames, e.g. set /p="Please input the base filename".
Post Reply