Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Zip IIS Web Logs

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,61836
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
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!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Zip IIS Web Logs - 6/25/2008 12:34:34 AM   
  BDIntern

 

Posts: 32
Score: 0
Joined: 5/19/2006
Status: offline
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!

_____________________________

"640k ought to be enough for anybody"
-Bill Gates
 
 
Post #: 1
 
 RE: Zip IIS Web Logs - 6/25/2008 3:53:30 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
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?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to BDIntern)
 
 
Post #: 2
 
 RE: Zip IIS Web Logs - 6/25/2008 3:58:15 AM   
  BDIntern

 

Posts: 32
Score: 0
Joined: 5/19/2006
Status: offline
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 .

_____________________________

"640k ought to be enough for anybody"
-Bill Gates

(in reply to ebgreen)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Zip IIS Web Logs Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts