move the file with timestamp

August 24, 2008 at 10:59:19
Specs: xp, intel
Hi All,

I have a file by name sample.txt in FolderA..I have to copy this file to FolderB..,and i have to attached current system timestamp at the end of the file as follows sample.txt_200808242327

I am able to do this by individual commands at command prompt by copy and then using %date% and %time% variables..but i need to execute this from a .bat scripting..please help me how can i keep this in .Bat


See More: move the file with timestamp

Report •

August 25, 2008 at 06:33:04
I suppose you have worked ut how to get the needed parts of %DATE% and %TIME%, since they almost always contain chars not allowed in file names.

So if you've gotten these into vars, let's say %D% and %T%,::

copy sample.txt foldB\sample.txt%D%%T%

If at first you don't succeed, you're about average.


Report •
Related Solutions

Ask Question