i have files and This names the files example :
JavaScript
x
log(2).txt
log(3).txt
log(4).txt
log.txt
I want Rename all of them to file names with numbers like:
JavaScript
1.txt
2.txt
3.txt
4.txt
system windows or linux
Advertisement
Answer
Just save this code into a name.bat file in your folder and run the command
JavaScript
@echo off
setlocal EnableDelayedExpansion
set i=0
for %%a in (*.txt) do (
set /a i+=1
ren "%%a" "!i!.new"
)
ren *.new *.txt
Here in order to avoid conflicts first the files are named as ‘.new’ extenstion and later it is converted back to ‘.txt’ files.