There is a group of files in the same directory with the names

12345.jpeg asdfafsa.jpeg ... 

We need to bring them to the value

 1.jpeg 2.jpeg и так далее. 

Total Commander dies with so many files (about 10 million).
OS Win7 x64

  • How exactly to rename? What is the replacement algorithm? How does the total die? - gbg
  • According to the wiki, total is alive: ru.wikipedia.org/wiki/Total_Commander Beta version 9.0 beta 10 (August 17, 2016) - user207618
  • one
    @Other probably meant "fails" - slippyk
  • Skriptek on Python and put on the night - Vladimir Martyanov
  • 3
    How did you live up to 10 million files in one folder? - tutankhamun

1 answer 1

Via bat file

 @echo off set all=0 set dir=D:\work\1\ set dim=xls set new=file_change set mask=filex for %%x in ("%dir%*.*") do (set /A all+=1) for /l %%y in (1,1,%all%) do (if exist "%dir%%mask%*%%y*.%dim%" (rename "%dir%%mask%*%%y*.%dim%" "%new%%%y.%dim%") else (echo files are not found)) pause 

Then try this (place the file in the folder with the files):

 @echo off set j=0 for %%i in (*.jpeg) do ( set /a j+=1 call :renamefile %%i %j ) goto :end :renamefile ren %1 %j%.jpeg :end 

PS only problem with Russian names

  • files are not found To continue, press any key. . . I will specify the jpeg file extension. The location indicated its own. - Alexey
  • @ Alexey, did you replace the folder in the batch file? with D: \ work \ 1 \ to yours - V. Dmitriy
  • Yes of course. + Like the bracket closed. All as you wrote. I thought that maybe a problem in the 4-character file extension - Alex
  • The same situation, only now several times writes that the file was not found and closes. I tried to change the encoding to no avail. - Alexey
  • one
    Yes, thank you very much everything works. I didn’t want to work because of cyrillic paths and file names. - Alexey