Um - how about two tasks calling this script with two definitions in the ini file.
First scheduled task archives the logs. Specify the same source and dest dirs and it will just rename the files in place. No deletion will occur.
Second task just deletes files more than 1 day old that begin with the archive identifier "A-!*" - this will clean up your archived files.
Here's an example config file:
Code:
[EVENT1]
# Rename the files at end of month (or 00:00 on the first)
# Keep the archived files in the same folder!
SRCDIR=C:\path\to\logs
DSTDIR=C:\path\to\logs
FILES=*.log
BACKUP=1
DELETE=0
AGE=0
[EVENT2]
# Delete on the 7th of every month
SRCDIR=
DSTDIR=C:\path\to\logs
FILES=A-!*.log
BACKUP=0
DELETE=1
AGE=1
Keep in mind that you might need to add the definition to stop a service prior to archiving (Event1).
No need to recode anything, if I understand you correctly. Finally, no need for a start date in this script, as you can define start dates in the scheduler.
I use this exact process for one application. The scheduled task references LogMaint.bat with the name of the INI file section. The INI file path is hard-coded to \usr\local - this might be the only mod you really need to make aside from the script path reference in the bat file.
Glenn
_________________________
Actually I
am a Rocket Scientist!