Announcement

Collapse
No announcement yet.

purge old log files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • purge old log files

    I have a script which is automatically run by the Win 10 task scheduler on a nightly basis to mirror my main hard drive to a backup drive.
    I create a log file with a date/time stamp in the file name each time it runs.
    For ex: BCBDocsSynclog_2020-03-02_09-52-47.txt

    Is there a way to automatically get rid of these log files since I don't want them to accumulate infinitely? Perhaps by deleting those older than a month? Or maybe by only keeping X number of logs and deleting the oldest ones?

  • #2
    As a separate task and a new script, you could set a filter to exclude all newer than 1 month files, leaving only old files, then select all files and delete. Please note that script does not preview actions before committing them, and there is no Undo option for an action taken, and files do not always get sent to the Recycle Bin even if the option is enabled. I would suggest testing with a cloned test folder first.

    As an example script could be:
    filter cutoff:>30days
    load "c:\yourlogs"
    expand all
    folder-report layout:side-by-side output-to:"c:\temp\report.html" output-options:html-color
    Aaron P Scooter Software

    Comment

    Working...
    X