I have 1000's of files without extensions. but these files are named as below
xxxxxxxxxxxxxxxx12345-xxxxxxxxxxxxxxxxxxxxx
or
xxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxx12345
my request is
search for files containing 12345 in their names and rename them with unique
names of xxxxxxxxxx.txt (10 Char name) with .txt extension.
source and destination folder's are the same E:\test
is this possible
if so please help
thanx in advance
rename extention of a file
Moderator: DosItHelp
Re: rename extention of a file
You might do something like that (sketched and untested):
Sidenote: I echoed the commands it should do, so you can check if that's what you like to perform.
In case you are satisfied with the commands created, you might want to delete the "echo(".
penpen
Code: Select all
@echo off
setlocal enableExtensions disableDelayedExpansion
set "N=1000000000"
for %%a in ("*12345-*" "*-*12345") do (
for /f "tokens=* delims=" %b in ('set /a "N"') do (
echo(ren "%%~a" "%%~b.txt"
)
set /a "N+=1"
)
goto :eof
In case you are satisfied with the commands created, you might want to delete the "echo(".
penpen