General discussion


COPY Command in DOS

By naseemi ·

I wish to copy a file (C:\DIRECTORY1\FILE1.TXT) to another subdirectory but with the current date appended to the filename (C:\DIRECTORY2\FILE1_20APR2005.TXT)

Is there a way to do this type of file copy using the COPY command (or any other) in DOS? I want to write this into a batch file as a form of backup process.

Please email me at :

Many thanks in advance


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by pryzhkov In reply to COPY Command in DOS

If You set in Your batch file something like:

SET CC=%DATE:~4,2%-%DATE:~7,2%-%DATE:~10,4%

it will give You the value of current date,
i. e. 04-20-2005. So You can use it to change the name of Your file...

Collapse -

by deveshpradhan In reply to COPY Command in DOS

Try this
SET CC=%DATE:~0,2%%DATE:~3,2%%DATE:~6,4%

This will create a file named FILE1.TXT_22042005
in the C:\DIRECTORY1 folder.

Hope this helps you.

Good Luck

Collapse -

by naseemi In reply to COPY Command in DOS

Thanks guys!
All sorted out!
Much appreciated

Related Discussions

Related Forums