Assing values within the file

Microsoft Windows xp professional w/serv...
June 1, 2010 at 05:22:54
Specs: Windows XP
Hi,

Requirement is that the file name is to be
changed with Entry of Date.

File name: RPT1-02-JAN-10-TO-02-JAN-10.txt

After naming conversion done

File Name: AB5000.txt

Description of the file name
AB5000.txt
MONTH : A
DATE : B
DESCRIPTION: 5000
Type of file: .txt

Month to be assigned within the file or earlier
MONTH would be
JAN-A
FEB-B
MAR-C
APR-D
and so on

DATE would be
1-A
2-B
.
.
26-Z
27-1
28-2
29-3
30-4
31-5


Here i will be entering only one string

02-JAN-10

The file name has to be changed as per the
requirement.

Can you help me on this

Ne0


See More: Assing values within the file

Report •

#1
June 3, 2010 at 20:54:23
don't know about the rest, this might work to convert day/month:
@echo off & setlocal enabledelayedexpansion
set alph=-ABCDEFGHIJKLMNOPQRSTUVWXYZ01234
set cc=0
for %%a in (jan feb mar apr may jun jul aug sep oct nov dec) do (
set /a cc+=1
set %%a=!cc!
)
for /f "tokens=2-3 delims=-" %%a in ('dir /b /a-d rpt*.txt') do (
echo converting %%a %%b:
call :xx %%a !%%b!
echo !res!
)
goto :eof
:xx
set day=%1
set test=%day:~0,1%
if %test% equ 0 set day=%day:~1%
set day=!alph:~%day%,1!
set mo=!alph:~%2,1!
set res=%mo%%day%

Report •
Related Solutions


Ask Question