Renaming the filename without '-'


Joined
May 5, 2008
Messages
1
Reaction score
0
I am using ms dos .Bat scripting...i have lot of files in a folder and the file names are as below.

DISPATCH_BY_PROVIDER_2008-02-21.txt
DISPATCH_BY_PROVIDER_2008-03-17.txt
DISPATCH_BY_PROVIDER_2008-04-19.txt
DISPATCH_BY_PROVIDER_2008-01-23.txt
DISPATCH_BY_PROVIDER_2008-02-01.txt

i need to change the file names as below throuh a batch script in dos

DISPATCH_BY_PROVIDER_20080221.txt
DISPATCH_BY_PROVIDER_20080317.txt
DISPATCH_BY_PROVIDER_20080419.txt
DISPATCH_BY_PROVIDER_20080123.txt
DISPATCH_BY_PROVIDER_20080201.txt



I am trying the below script
@echo off
set file_path=C:\dir
set prg_path=C:\
set filename=CLI
dir /b c:\dir >list.txt
for /f %%I in (list.txt) do (
for /f "eol=; tokens=1,2,3* delims=- " %%i in ('echo %%i') do (
ren %%I filename_yyyymmdd.txt
)
)

but iam not getting proper results

please help me out,how can i rename these files

Best Regards,
Shalini
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top