Need help moving date from front of file name

September 15, 2010 at 12:22:14
Specs: Windows XP
I have files that need to be renamed

Ex. of what have
2010 08 MED Access - full.mdb

What I need
MED_Access_Full201008.mdb

I need this to be written in a bat(batch) since another person will be using it.


See More: Need help moving date from front of file name

Report •


#1
September 16, 2010 at 02:34:09
Try this - it is untested. Remove REM when you are satisfied it will do what you want.

@echo off
cls
setlocal

pushd "path\to\mdb\files\"|| echo Pushd failed - job terminated.&& exit /b

    for /f "tokens=1-6 delims=-. " %%1 in ('dir /a-d /b *.mdb') do (
        echo File to be renamed=%%1 %%2 %%3 %%4 - %%5.%%6
        echo New file name=%%3_%%4_Full%%1%%2.%%6
        echo.
        
        REM ren "%%1 %%2 %%3 %%4 - %%5.%%6" %%3_%%4_Full%%1%%2.%%6
        )

popd


Report •

#2
September 16, 2010 at 04:22:53
Thank you for your assistance. This is exactly what I need.

Report •

#3
September 16, 2010 at 07:56:23
T.C.,

I like it.


=====================================
Helping others achieve escape felicity

M2


Report •

Related Solutions

#4
September 16, 2010 at 15:11:36
HJYOUNGII - You're welcome and thanks for coming back to report your success.

M2 - Thank you for your comment.


Report •

Ask Question