Computing.Net > Forums > Disk Operating System > Appending a Date to filename

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Appending a Date to filename

Reply to Message Icon

Name: Steel
Date: April 3, 2003 at 09:28:32 Pacific
OS: NT 4.0
CPU/Ram: Pentium/?
Comment:

Hi,

What I am doing is creating a batch file that will take a backup of a configuration file on my NT 4.0 Web server. What I would like to do is copy it from one subdirectory to another on the same server, which I have complete, but my problem is that I want to append the date to the end of the file name in the format of "filename.txt.yymmdd". Is there a way to do this? Any help would be greatly appreciated.

Thanks,
Steel



Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: April 3, 2003 at 09:52:14 Pacific
Reply:

You can make the process automatic with a batch script (.bat file). Use this code to get current system's date into the variable %DATE% with the format YYMMDD:

@echo off
for /F "tokens=2-4 delims=/- " %%A in ('date/T') do set DATE=%%C%%A%%B
set DATE=%DATE:~2%

Then after that, just use the variable as you will.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br

____________________________________________________________________________


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Appending a Date to filename

Adding a date to a filename www.computing.net/answers/dos/adding-a-date-to-a-filename/13542.html

Append or write to the end www.computing.net/answers/dos/append-or-write-to-the-end/13002.html

Appending Datestamp to Filename www.computing.net/answers/dos/appending-datestamp-to-filename/13097.html