hi
I have hundreds of log files in a directory named (any name).12345 (the extension is of five digits).
my request is to rename all files in that folder with a unique name and .txt extension.
file / extension renaming
Moderator: DosItHelp
Re: file / extension renaming
How should your unique names look like? And is there any rule where to start (e.g. by file name ascending or by file time)?
Another possibility could be to just append .txt to the files. They would look like "whatevername.12345.txt" afterwards.
Steffen
Another possibility could be to just append .txt to the files. They would look like "whatevername.12345.txt" afterwards.
Steffen
Re: file / extension renaming
yes just append a .txt to file because its already names with ddmmyyhhmmss format
Re: file / extension renaming
Code: Select all
for /f "delims=" %%i in ('dir /a-d /b *.* ^| findstr /e "\.[0-9][0-9][0-9][0-9][0-9]"') do (
ren "%%~i" "%%~i.txt"
REM ren "%%~i" "%%~ni.txt"
)
Steffen