I do not have such a script for Windows but I did write something similar for Linux that would essentially delete any files older than a set number of days in given folders, or in the case of midtier logs that don't roll by date (server.log or the web app logs) remove the lines prior to the date of the set number of days prior. I'm sure it would be possible to write such a script in PowerShell for Windows, but this is not a function of SAS.
-- Greg Wootton | Principal Systems Technical Support Engineer
You need to be aware of not accidentally deleting "live logs". For this reason, I only run log "Cleanup" scripts when I take all SAS services down for monthly maintenance. I do schedule a cleanup on logs that are not live like batch logs and have some logic to delete files based on last modified date. I have attached some script snippets to hopefully give you some inspiration. I tend to wrap PowerShell scrips inside .cmd commands...but YMMV as there are so many ways to do things.
Looks like there is a logrotate like utility available on windows. The details are available at GitHub - plecos/logrotatewin: This is a Windows implementation of the logrotate utility found in Lin... On Unix/Linux this is used routinely to archive and then remove old logs. However, for windows recommend testing and due diligence before using it. In case you adopt it please share your experiences for the benefit of other users.
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.