Solved Rename file containing date - withoud delimiters

May 15, 2012 at 05:30:25
Specs: Windows 7
I would like to create a batch file that will rename a list of files in a folder in the following way:

example: ABCYYYYMMDD.txt => ABCDDMMYY.txt
so only the 'date-part' is modified from YYYYMMDD to DDMMYY

See More: Rename file containing date - withoud delimiters

Report •

May 15, 2012 at 06:48:28
✔ Best Answer
Assuming your files all follow that naming convention:

@echo off & setlocal enabledelayedexpansion
for /f "tokens=*" %%i in (
'dir /b *.txt'
) do (
set _=%%~ni
set nn=!_:~0,3!
set yy=!_:~5,2!
set mm=!_:~7,2!
set dd=!_:~9,2!
echo move !_!.txt !nn!!dd!!mm!!yy!.txt

If the output looks correct, remove the echo.


Report •

May 16, 2012 at 00:58:45
Thank you Tony. This worked!!

Report •
Related Solutions

Ask Question