General discussion

Locked

copy a file to the current date in NT

By jrosalia ·
I would like to know if it is possible to copy a file in DOS on a WINNT workstation to the current date. I tried %date% and it did not work. If not in DOS, how about in C ? I have an old copy of a C compiler for Dos. Thanks

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
Thread display: Collapse - | Expand +

All Comments

Collapse -

by Joseph Moore In reply to copy a file to the curre ...

Wait a sec. Let me make sure I understand your question.

Are you asking how to copy a file, and have the file name of the copy be the current date? If so, here is how.

Say you want to copy C:\Temp\FILE1.TXT into C:\Backup with a filename of 10-15-2003.txt

This BAT file will do it:


@echo off
c:
cd\
cd temp
for /f "tokens=1-4 delims=: " %%i in ('date /t') do set nowdate=%%j-%%k-%%l
copy FILE1.TXT C:\Backup\%nowdate%.txt
EXIT

Collapse -

by jrosalia In reply to

Great. thanks for your help

Collapse -

by jrosalia In reply to copy a file to the curre ...

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums