Hi there,
I'm trying to archive and rotate some log files from a profile deletion script.
The batch file creates a file "OCPN2_master.log" from the script. This is what I currently have but it's kind of ugly:
I'd like to be able to archive indefinitely, or only keep the oldest 3 log files with a rotating number (i.e. 1 becomes 2, 2 becomes 3, 3 becomes 1 again). Is this possible?
I was previously posting under "GeneralDzur" but hgate73 is my new username.
I'm trying to archive and rotate some log files from a profile deletion script.
The batch file creates a file "OCPN2_master.log" from the script. This is what I currently have but it's kind of ugly:
Code:
:: Log file rotation section. Archives up to 6 backups, ("backup" through "backup5) and deletes backup6 if it exists
IF EXIST Logs\OCPN2_master.log.backup6 del Logs\OCPN2_master.log.backup6
IF EXIST Logs\OCPN2_master.log.backup5 rename Logs\OCPN2_master.log.backup5 OCPN2_master.log.backup6
IF EXIST Logs\OCPN2_master.log.backup4 rename Logs\OCPN2_master.log.backup4 OCPN2_master.log.backup5
IF EXIST Logs\OCPN2_master.log.backup3 rename Logs\OCPN2_master.log.backup3 OCPN2_master.log.backup4
IF EXIST Logs\OCPN2_master.log.backup2 rename Logs\OCPN2_master.log.backup2 OCPN2_master.log.backup3
IF EXIST Logs\OCPN2_master.log.backup rename Logs\OCPN2_master.log.backup OCPN2_master.log.backup2
IF EXIST Logs\OCPN2_master.log rename Logs\OCPN2_master.log OCPN2_master.log.backup
I'd like to be able to archive indefinitely, or only keep the oldest 3 log files with a rotating number (i.e. 1 becomes 2, 2 becomes 3, 3 becomes 1 again). Is this possible?
I was previously posting under "GeneralDzur" but hgate73 is my new username.