All Forums >> [Scripting] >> Post a VBScript >> Zip IIS Web Logs Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
This script compresses log files in specified folders that are older than 7 days and then adds them to an existing zip file using WinZip. This works by using a batch file to call multiple vbscript files. If you use this code make sure you either empty the recycle bin when the code is finished, or call a script at the end of the batch file to empty the recycle bin for you.
The script itself has two parts, the first part moves any log files that are older than 7 days to a "temp" folder, and the second adds all files in the temp folder to the specified zip file. (I did this because I could not figure out how to move files older than 7 days directly to a zip file, it would always move every file in the target folder, so the work-around was to move the files to a temp folder first).
I've stolen / borrowed code from a few different people on this site and other to get exactly what I need, so thank you to all who have helped me!
.bat file to call VBScript files:
VBScript to move log files older than 7 days:
VBScript to add files in temp folder to specified zip file:
This task of manually compressing weblogs took my anywhere from 3-4 hours weekly, now with this script I just double click and walk away! I hope this helps someone as much as it helped me!
Thanks for sharing. I was just wondering if there was a reason for splitting the code up and running a bat instead of just running everything in one vbs?
I did it this way because I have nearly 20 sites in 20 different folders. There is probably a much more efficient way to do this, but it works for me .