I know you have had a lot of answers on this one, but you CAN do it with
batch files...
@echo off
for /F "tokens=1,2" %%d in ('date /T') do set day=%%d & set date=%%e
set yyyy=%DATE:~6,4%
set mm=%DATE:~3,2%
set dd=%DATE:~0,2%
set dateserial=%yyyy%%mm%%dd%
will create the dateserial environment variable as 20010109 today. It is a
fairly simple matter to adjust this to most formats, but I think that is
what you wanted, without resorting to Perl.
Cheers
Simon West
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 08 January 2001 19:14
To: [EMAIL PROTECTED]
Subject: [analog-help] Renaming a file to include a datestamp
automatically
Hello all,
This is slightly off-topic, but I have been trying to figure this out for a
long time.
I was wondering if there is a way on NT to rename a file to include a
datestamp in the name. Basically I want a task to run nightly that will
stop Apache, rename the logfile to something like "access.log.20010108",
then restart Apache. I'm not sure if this can be done in a regular batch
file, but I'm fairly certain that it can be done in Perl or VBScript.
I've done some searching on the web for file renaming utilities, but
everything I find is for mass renaming of MP3's or something. Also,
everything is a GUI utility. I need something that can be run from a
command line by Task Scheduler.
If anyone has an idea of how this can be done or knows where I can find the
info on how this is done, please post it here. Thanks for your help!
Michael
------------------------------------------------------------------------
This is the analog-help mailing list. To unsubscribe from this
mailing list, send mail to [EMAIL PROTECTED]
with "unsubscribe" in the main BODY OF THE MESSAGE.
List archived at http://www.mail-archive.com/[email protected]/
------------------------------------------------------------------------
------------------------------------------------------------------------
This is the analog-help mailing list. To unsubscribe from this
mailing list, send mail to [EMAIL PROTECTED]
with "unsubscribe" in the main BODY OF THE MESSAGE.
List archived at http://www.mail-archive.com/[email protected]/
------------------------------------------------------------------------