Answer the question
In order to leave comments, you need to log in
How to rename files using bat file?
There is a bat file that must go through all the folders (the folder names are always different) that are in the same directory with it, and in each folder there is an index.txt file, which must be renamed to content.txt. How to do it?
Answer the question
In order to leave comments, you need to log in
Here's my solution , it's not an answer to the question, but I want to leave it here for similar requests.
This .bat file will rename .Jpg files from the Result folder into these files file-000.jpg, file-001.jpg, file-002.jpg
The Result folder is next to the bat file.
Initially, in the Result folder, the names of .Jpg files can be completely different .. It does not matter.
setlocal enabledelayedexpansion
cd /d Result
set "count=1000"
set a="*.jpg"
for /f "usebackq delims=*" %%f in (`dir /b /o:-d %a%`) do (ren "%%f" file-!count:~1!.jpg
set /a count+=1
)
pause
set "count=1000" The count starts from file-000.jpg then file-001.jpg and so on.
set "count=1001" The count starts from file-001.jpg then file-002.jpg and so on.
/o:d - Sort the list of displayed files (oldest to newest).
If you need to change the sort order of files.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question