Hi,
I am trying to rename a file as
"Serial number_File name_Current Date and Time"
Which assigns the prefix as serial number, then the file name and the suffix as current date and time.
This should be done for all file.
The code that I am trying is :
@ echo off
echo Your File has been moved to the destination folder.
ren C:\Users\kunjay_shah\kunjay\src\*.* *.*_%date:~4,2%-%date:~7,2%-%date:~10,4%_%time:~0,2%%time:~3,2%_%time:~6,5%.txt
: SETLOCAL ENABLEDELAYEDEXPANSION
: SET count=1
: FOR %%F IN (C:\Users\kunjay_shah\kunjay\src\*.*) "%%~dpF!count!.txt" & SET /a count=!count!+1
: ENDLOCAL
move C:\Users\kunjay_shah\kunjay\src\*.* C:\Users\kunjay_shah\kunjay\dst\
:rename C:\Users\kunjay_shah\kunjay\dst\*.* *.*_%date:~10,4%-%date:~4,2%-%date:~7,2%_%HR%%time:~3,2%.txt
:set HR=%time:~0,2%
: set HR=%Hr: =0%
: set HR=%HR: =%
: for /f "tokens=1-5 delims=/ " %%d in ("%date%" "%time%") do rename "C:\Users\kunjay_shah\kunjay\dst\*.*" %%e-%%f-%%g - %%d-%%e.txt
: for /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename "C:\Users\kunjay_shah\kunjay\dst\*.*" %%e-%%f-%%g.txt
: for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename "C:\Users\kunjay_shah\kunjay\dst\*.*" %%d-%%e.txt
: pause
Please advise.
Regards, Kunjay Shah