Batch file to move/rename with timestamp

June 22, 2010 at 14:51:30
Specs: Windows 2003 Server
Hi All,

I want to create a batch file to move (not copy) a file Agg.DAT from the following source location to the following destination location. I want to rename the file with a timestamp (just after the file name) when it move to the destination folder.

Source Location:

Destination Location:

How can I create such a batch file.

Thanks a lot for your help.


See More: Batch file to move/rename with timestamp

Report •

June 22, 2010 at 15:03:17
Can someone help please?



Report •

June 22, 2010 at 18:42:29
@echo off
for /f "skip=6 tokens=1-5*" %%a in ('dir D:\KR\Zee\Test_Batch\Import\agg.dat') do move "%%e" D:\KR\Zee\Test_Batch\Move\"%%e_%%a_%%b%%c"

::or alternatively:
for %%a in (D:\KR\Zee\Test_Batch\Import\agg.dat) do move %%a D:\KR\Zee\Test_Batch\Move\"%%a_%%~ta"

Report •

Related Solutions

Ask Question