Computing.Net > Forums > Programming > System date in file names

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.

System date in file names

Reply to Message Icon

Name: Nearlynormal
Date: September 26, 2004 at 15:50:32 Pacific
OS: Win2KPro
CPU/Ram: PIII1.4, 256MB
Comment:

Our office network uses Win2K Server and our PCs use Win2KPro. We are using a program called RealPopup for text messaging between PCs. RealPopup allows each PC to log all messages in a plain-text file with a .log extension. I would like to save each day's messages in a separate file. I am trying to figure out how to write a batch file that would run every evening that would rename the logfile from, e.g., Logfile.log to a file named with the system date, i.e., mmddyy.log, and then would create a new, empty Logfile.log file for the next day.



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: September 27, 2004 at 00:03:20 Pacific
Reply:

Hi,

ren Logfile.log "%DATE%".log

@echo off > Logfile.log

::-----
Your mileage may vary, according to the way your date is formatted (in control panel).

If it has a colon or slash, it won't fly. Commas and dots aren't so wonderful, either.

HTH



0

Response Number 2
Name: FishMonger
Date: September 27, 2004 at 12:07:41 Pacific
Reply:

You can build-up/re-arrange the output of the date command.

C:\>echo %date%
Mon 09/27/2004

C:\>echo %date:~4,2%%date:~7,2%%date:~12,2%.log
092704.log


0

Sponsored Link
Ads by Google
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 Programming Forum Home


Sponsored links

Ads by Google


Results for: System date in file names

batch file:Insert date in file www.computing.net/answers/programming/batch-fileinsert-date-in-file/11123.html

Appending date to file name www.computing.net/answers/programming/appending-date-to-file-name/616.html

DOS: Adding date to file name. www.computing.net/answers/programming/dos-adding-date-to-file-name/11491.html