Elon's Blog

Stuff that may be of use to someone…

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.

Advertisement

Please Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: