The button to insert a "+" , but at the part of the keyboard which is for digits only:
7 8 9 -
4 5 6 + << that
1 2 3 Enter
Or on a Notebook the number keys accessible together with the [FN] -key (but don't know if that works there)
Moderators: Hacker, petermad, Stefan2, white
Yes the + key on the numeric keypad (just the one key). Note it only works after a search for "Find duplicate files" -> "Feed to listbox".What do you mean about 'Num+
I shall see what I can dois 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?
Code: Select all
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 !c! GTR 9 (set D0=D) else (set D0=D0)) & 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
Code: Select all
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 !c! GTR 9 (set D0=D) else (set D0=D0)) & 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
petermad wrote: 2021-10-29, 20:47 UTC This script should remove the leading 0 in D0x for values over 9:You're a magician! That works great. Do you have any idea why does it take so long, though. It takes 40mins to rename 21k files (the same, while using the button and by Total Commander's script). During renaming it does use like 2MB/s on my m.2 drive + just a very little power from CPU.Code: Select all
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 !c! GTR 9 (set D0=D) else (set D0=D0)) & 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
That 40mins it's super fantastic, for me, but my ambition requires to find a way to make it quicker.
We used to improve our work at the office by creating RAID0 with the fastest NVME drives available at the time.
Thanks, I use "+" all the time, but, still, I don't see how to delete the duplicats with saving the orginals.Stefan2 wrote: 2021-10-29, 14:49 UTC
The button to insert a "+" , but at the part of the keyboard which is for digits only:
7 8 9 -
4 5 6 + << that
1 2 3 Enter
Or on a Notebook the number keys accessible together with the [FN] -key (but don't know if that works there)
Let's say I have 2 files:
c:\folder1\1.txt
c:\folder1\subfolder1\2.txt
and both contain the same content. I'm using "Find Files" -> advanced -> Find duplicate files -> "same size" + "same contents" -> Start search
so I end with the list of files (I click "Feed to list"):
1.txt
2.txt
--------------------------------------------------
I have to manually click one of them with a mouse. Or I can use Insert key, then arrow down, but when I have 1000 files like that it's annoying.
Do you have any idea how to avoid clicking?
And after doing that it is that you have to press the Num+ button - try it.Let's say I have 2 files:
c:\folder1\1.txt
c:\folder1\subfolder1\2.txt
and both contain the same content. I'm using "Find Files" -> advanced -> Find duplicate files -> "same size" + "same contents" -> Start search
so I end with the list of files (I click "Feed to list"):
1.txt
2.txt
If you are sure that there is ALWAY a space in the file names, and you don't need the safety of not renaming the files twice (by accidently pressing the button again and getting file names like: something D01 DO1 01.abc) then the script can be reduced to:That 40mins it's super fantastic, for me, but my ambition requires to find a way to make it quicker.
Code: Select all
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 !c! GTR 9 (set D0=D) else (set D0=D0)) & for /f "tokens=1* delims= " %%G in ("%%~nf") do 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
yey!petermad wrote: 2021-11-02, 19:30 UTCAnd after doing that it is that you have to press the Num+ button - try it.Let's say I have 2 files:
c:\folder1\1.txt
c:\folder1\subfolder1\2.txt
and both contain the same content. I'm using "Find Files" -> advanced -> Find duplicate files -> "same size" + "same contents" -> Start search
so I end with the list of files (I click "Feed to list"):
1.txt
2.txt
25min! Thanks, it's fantastic.petermad wrote: 2021-11-02, 19:37 UTCIf you are sure that there is ALWAY a space in the file names, and you don't need the safety of not renaming the files twice (by accidently pressing the button again and getting file names like: something D01 DO1 01.abc) then the script can be reduced to:That 40mins it's super fantastic, for me, but my ambition requires to find a way to make it quicker.Code: Select all
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 !c! GTR 9 (set D0=D) else (set D0=D0)) & for /f "tokens=1* delims= " %%G in ("%%~nf") do 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
Try and see if this is faster...
Works amazing, but creates an extra ")" in the extension (like "test d01.abc)". I thought it's because of the part "else (set D0=D0))", but after reducing .abc) goes to .abc, but there are no more D10, just D09, then there's nothing. Not a big deal, one change in Total Commander but the code is 99% complete.petermad wrote: 2021-11-02, 19:37 UTCIf you are sure that there is ALWAY a space in the file names, and you don't need the safety of not renaming the files twice (by accidently pressing the button again and getting file names like: something D01 DO1 01.abc) then the script can be reduced to:That 40mins it's super fantastic, for me, but my ambition requires to find a way to make it quicker.Code: Select all
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 !c! GTR 9 (set D0=D) else (set D0=D0)) & for /f "tokens=1* delims= " %%G in ("%%~nf") do 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
It was due to a remaining ) at the end of the script. This button should work:but creates an extra ")" in the extension (like "test d01.abc)".
Code: Select all
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 !c! GTR 9 (set D0=D) else (set D0=D0)) & for /f "tokens=1* delims= " %%G in ("%%~nf") do 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
petermad wrote: 2021-11-16, 12:40 UTC 2sydIt was due to a remaining ) at the end of the script. This button should work:but creates an extra ")" in the extension (like "test d01.abc)".
Code: Select all
@echo off
echo Are you sure you want to rename all files in this folder and it's subfolders?
echo.
echo If not press Ctrl+C to cancel
echo.
pause
SETLOCAL ENABLEDELAYEDEXPANSION
set c=0
set d=0
echo Renaming files...
echo.
for /r %%f in (*) do (if not "%%~pf"=="!d!" set c=0) & (set d=%%~pf) & (set /a c+=1) & (if !c! GTR 9 (set D0=D) else (set D0=D0)) & for /f "tokens=1* delims= " %%G in ("%%~nf") do ren "%%f" "%%G !D0!!c! %%H%%~xf")
echo.
pause