I am trying to create a batch file that renames all the files in the folder by its name and created date. For example >User file name change it to >User_13-06-2012. Please help me.
I have this code which just add the new date with the name.
@echo off
cd "C:\account folder"
for /f "tokens=1-3 delims=/" %%a in ('echo %date%') do set today=%%a%%b%%c
for %%f in (*.*) do ren "%%f" "%%~nf_%today%%%~xf"
Thanks from now.
Edited: previous answer was incorrectly showing modification time, not creation time.
This
will spit out new names for your files formatted as per your req. Should it fairly easy to work from this.
Note: This assumes your date separator is ‘/’ and in general it’s locale dependent
Edit: as pure batch solution above is inherently unreliable below is equivalent powershell one liner – it’s faster, locale independent and easy to modify. I would recommend to use this instead if ps is available.