To make the button:
1. Mark the text in the box here above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctrl+C).
3. Right click on TC's buttonbar and choose "Paste".
NOTE - the script assumes that you want to rename all files in the subfolders, if you only want to rename files of a certain type, the script has to be changed.
The script will only rename files that does not already has D0X in the filename, so there is no risk of double renaming if the script is accidently run twice.
You can also use this button without a RenameD0X.bat file:
TOTALCMD#BAR#DATA
%COMSPEC% /V:ON /C
set c=0 & set d=0 & for /r %%f in (*) do (if not "%%~pf "=="!d!" set c=0) & set d=%%~pf & set /a c+=1 & if not exist "%%~pf* D0!c!%%~xf" if "%%~xf"==".abc" ren "%%f" "%%~nf D0!c!%%~xf"D0!c!%%~xf"
wcmicons.dll,63
Rename (add D0x) to all file names in all subfolders
1
-1
Since there is no warnings with this button, it will only rename *.abc files and still only once.
I even can't describe how impressed I am! I looked up for the fastest m.2 drive to improve renaming then I tried the script, before buying I took 21k files and tried the script - it has changed all the names in 47s! It's just incredible.
Do you think, is there a chance to make a script that moves thos 'Dxx' on the first ' ' (space) of the file name?
something 01 D01.abc -> something D01 01.abc
TOTALCMD#BAR#DATA
%COMSPEC% /V:ON /C
set c=0 & set d=0 & for /r %%f in (*) do (if not "%%~pf "=="!d!" set c=0) & set d=%%~pf & set /a c+=1 & if not exist "%%~pf* D0!c!%%~xf" if "%%~xf"==".abc" ren "%%f" "%%~nf D0!c!%%~xf"
wcmicons.dll,63
Rename (add D0x) to all file names in all subfolders
1
-1
syd wrote:Do you think, is there a chance to make a script that moves thos 'Dxx' on the first ' ' (space) of the file name?
something 01 D01.abc -> something D01 01.abc
Do yo mean to place the D0 differently before doing any renaming, or do you mean to move the D0 on already renamed files?
Last edited by petermad on 2021-10-27, 17:33 UTC, edited 1 time in total.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14 TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
TOTALCMD#BAR#DATA
%COMSPEC% /V:ON /C
(set c=0) & (set d=0) & for /r %%f in (*) do (if not "%%~pf"=="!d!" set c=0) & (set d=%%~pf) & (set n=%%~nf) & (set /a c+=1) & if "%%~xf"==".abc" if not "!n:~-6,-4!"=="D0" ren "%%f" "!n:~0,-2!D0!c! !n:~-2!%%~xf"
wcmicons.dll,63
Rename (add D0x) to all file names in all subfolders
1
-1
It will still only rename *.abc files and only once. It dos not distinguish spaces in the file name it simply inserts D0x at the 3'rd last position of the name (i.e. for example before " 01")
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14 TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
TOTALCMD#BAR#DATA
%COMSPEC% /V:ON /C
(set c=0) & (set d=0) & for /r %%f in (*) do (if not "%%~pf"=="!d!" set c=0) & (set d=%%~pf) & (set n=%%~nf) & (set /a c+=1) & if "%%~xf"==".abc" if not "!n:~-6,-4!"=="D0" for /f "tokens=1* delims= " %%G in ('dir /a-d /b "%%f"') do ren "%%f" "%%G D0!c! %%H"
wcmicons.dll,63
Add D0x after the first space in all file names in all subfolders
1
-1
Notice if there is NO space in the file name then D0x will be added AFTER the file extension ( "something01.abc D01" )
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14 TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
TOTALCMD#BAR#DATA
%COMSPEC% /V:ON /C
(set c=0) & (set d=0) & for /r %%f in (*) do (if not "%%~pf"=="!d!" set c=0) & (set d=%%~pf) & (set n=%%~nf) & if "%%~xf"==".abc" (set /a c+=1) & for /f "tokens=1* delims= " %%G in ("%%~nf") do if not exist "*D0!c!*%%~xf" (if "%%H"=="" (ren "%%f" "%%G D0!c!%%~xf") else ren "%%f" "%%G D0!c! %%H%%~xf")
wcmicons.dll,63
Add D0x after the first space in all file names in all subfolders
1
-1
If there is no space in the file name d0x is put at the end of the name before the extension.
Better check for not already renamed files (existence of D0x in the file name)
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14 TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
wow! it works! I had problems, because an .abc extinsion was just an example. Is there a way to just leave the extension alone (to skip is, whatever it is)?
ps. If you're so good at this, maybe you can see the way to make the selection of every 2nd file (for example, when I want to delete all the doubles). If it's not that simple, might be for 100 files.
TOTALCMD#BAR#DATA
%COMSPEC% /V:ON /C
(set c=0) & (set d=0) & for /r %%f in (*) do (if not "%%~pf"=="!d!" set c=0) & (set d=%%~pf) & (set n=%%~nf) & (set /a c+=1) & for /f "tokens=1* delims= " %%G in ("%%~nf") do if not exist "*D0!c!*%%~xf" (if "%%H"=="" (ren "%%f" "%%G D0!c!%%~xf") else ren "%%f" "%%G D0!c! %%H%%~xf")
wcmicons.dll,63
Add D0x after the first space in all file names in all subfolders
1
-1
Then all file types will be renamed - be carefull not to launch it in the wrong folder !!!!! then (imagine the root !).
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14 TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
TOTALCMD#BAR#DATA
%COMSPEC% /V:ON /C
(set c=0) & (set d=0) & for /r %%f in (*) do (if not "%%~pf"=="!d!" set c=0) & (set d=%%~pf) (set /a c+=1) & for /f "tokens=1* delims= " %%G in ("%%~nf") do if not exist "%%~dpf*D0!c!*%%~xf" (if "%%H"=="" (ren "%%f" "%%G D0!c!%%~xf") else ren "%%f" "%%G D0!c! %%H%%~xf")
wcmicons.dll,63
Add D0x after the first space in all file names in all subfolders
1
-1
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14 TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
see the way to make the selection of every 2nd file
Do you want the script to just select the files in TC or do you want it to do somthing (like delete) every second file? Is it every odd or even file you want selected/deleted?
If you want selection (but no action) it can only be for the current folder, not for subfolders.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14 TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
2petermad
About the script:
Looks like the script from 12:35 works and the 'corrected' one from 14:19 doesn't.
About the every 2nd file thing:
I want just the selection,
let say I have a situation that I want to get rid of duplicates:
I'm searching for files that the size is the same, then 'Feed to lisbox' and then' I used to click insert, down arrow, insert like o lot. I tried using a 3rd party macro-soft, that record my keyboard, so that it would be easier to select hound-rets files without clicking manually, but it didn't work 100% ok.
I'm just imaging that I search for files, then have a list and then just click on the button:
- to select every 2nd file (Insert key) or
- to 100 cliks of Insert, down arrow at once.
TOTALCMD#BAR#DATA
%COMSPEC% /V:ON /C
(set c=0) & (set d=0) & for /r %%f in (*) do (if not "%%~pf"=="!d!" set c=0) & (set d=%%~pf) & (set /a c+=1) & for /f "tokens=1* delims= " %%G in ("%%~nf") do if not exist "%%~dpf*D0!c!*%%~xf" (if "%%H"=="" (ren "%%f" "%%G D0!c!%%~xf") else ren "%%f" "%%G D0!c! %%H%%~xf")
wcmicons.dll,63
Add D0x after the first space in all file names in all subfolders
1
-1
I repeat: Be carefull not to launch it in the wrong folder !!!!! then (imagine the root !).
Last edited by petermad on 2021-10-29, 13:56 UTC, edited 1 time in total.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14 TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
I'm searching for files that the size is the same, then 'Feed to lisbox' and then' I used to click insert, down arrow, insert like o lot. I tried using a 3rd party macro-soft, that record my keyboard, so that it would be easier to select hound-rets files without clicking manually, but it didn't work 100% ok.
I'm just imaging that I search for files, then have a list and then just click on the button:
- to select every 2nd file (Insert key) or
- to 100 cliks of Insert, down arrow at once.
I cannot make a DOS script work in a "Feed to listbox" panel.
But try the Advanced tab in the "Find Files" dialog and chose "Find duplicate files" -> "same size". Once you have done the search press "Feed to listbox". Now press the Num+ button - a very unknown feature in TC now pops up - the "Select duplicate files" - maybe that can be usefull for you.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14 TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
I'm searching for files that the size is the same, then 'Feed to lisbox' and then' I used to click insert, down arrow, insert like o lot. I tried using a 3rd party macro-soft, that record my keyboard, so that it would be easier to select hound-rets files without clicking manually, but it didn't work 100% ok.
I'm just imaging that I search for files, then have a list and then just click on the button:
- to select every 2nd file (Insert key) or
- to 100 cliks of Insert, down arrow at once.
I'm testing, after 23mins there are 18k files renamed, so another 10min to check
edit. Seems it works (33mins-I might have to buy fast NVME drive), is there a simple way to change the script to makes files, even there are more of them then 9? Like D01..D10, not D01..D010?
petermad wrote: 2021-10-29, 13:45 UTC
I cannot make a DOS script work in a "Feed to listbox" panel.
But try the Advanced tab in the "Find Files" dialog and chose "Find duplicate files" -> "same size". Once you have done the search press "Feed to listbox". Now press the Num+ button - a very unknown feature in TC now pops up - the "Select duplicate files" - maybe that can be usefull for you.
What do you mean about 'Num+ button[/b' ? Num on the numeric part of keyboard plus '+' button? I tried many combinations and I'm out of ideas.