I've updated the script to correct a methodology issue.

The script was always saving/updating the same file which updates the date each time, which invalidates checking the time the file was last updated.

Now the script creates a new file every time it's run. Once the script detects there are more then 7 archive files in the folder it will print out that message.

If you want to automate the log management please review these links for more information.

How to archive a file by Richard H.

Log Management by Glenn B.