A zip archive stores retained files separately from their active working location, making it useful for moving old logs into cold storage before cleanup. section 2.1
A practical archive-cleanup automation:
- Identify the folder containing log files. section 2.1
- Filter files by age, using a configurable day threshold. section 2.1
- Add qualifying files to an archive file, then remove the archived originals. section 2.1
Thirty-day log retention threshold
For logs retained on active storage for 30 days, calculate the cutoff from the current time with PowerShell's DateTime.AddDays method, then archive files older than that cutoff. Retain the archive for the required seven-year period. section 2.1
Figure 2.1 Design the first phase of the file cleanup automation by defining the required parameters and the steps to perform, such as getting the files to archive, performing the archive, and then cleaning up the archived files.
Use the workflow design to connect required parameters with file selection, archiving, and removal steps. section 2.1
