Elon's Blog

Stuff that may be of use to someone…

Posts Tagged ‘TIMESTAMP’

Move \ Copy Files with Date and timestamps using DOS commands

Posted by Elon B. on September 2, 2012

You can use DOS commands , possibly in a batch file (.bat)  if you want, to copy files from one location to another, adding a DATE or TIME stamp to the file name.

Open up a DOS\Command prompt window.

We can see the results of using the ECHO cammand to display the current date and time, as follows.

DOS Date and Time commands

We can then use this in our Dos COPY command as follows. [  copy *.txt *_%date:/=%_.txt  ]

Don’t forget you can use wildcards for the filenames as normal.

Copy adding DATE to filename

Copy with Date and Timestamp  [  copy *.txt *_%date:/=%_%TIME::=%.txt /Y ]

Add DATE and TIME to filename

Hope you find this useful.

Posted in Microsoft Related, SSIS, Windows 7, Windows Office - General | Tagged: , , , , | Leave a Comment »

 
%d bloggers like this: