här är ett vbscript för att packa iis-loggfiler... borde vara enkelt att trixa till för dina ändamål... tar inget ansvar för funktionen :lol:
kräver winrar på maskinen...
lycka till!
EDIT: oj missade att du redan hade fått hjälp... aja.. kanske är bra med nåt alternativ
Kod:
Option Explicit
'Installation
'-------------
'Update the following settings to relect the setup of your webserver
'
'This value should be set to the name of your server. Keep this to the same format
'as the example value.
Const serverName="7.0.0.1\"
'This value should be set to the root path to all of the domains on the webserver.
'Keep this to the same format as the example value. If you have more than one location
'of website folders you can have multiple copied of this script running for each location
Const DomainPath="c$\Domains\"
'This value sets the number of days worth of logs that should be kept. Any log files,
'either compressed or uncompressed, will by removed if they are older than the number of
'days set.
Const RemoveOlderThan=190
'This value sets the number of days worth of logs that should be kept unarchived. Any log files,
'uncompressed, will by compressed if they are older than the number of
'days set.
Const ArchiveOlderTHan=2
'To complete this application installation type in the following command into the
'command prompt so that the application runs within a command prompt instead of producing
'hundreds of message boxes:
' cscript //h:cscript
'
'The final step is to add this script into the Windows scheduled tasks. It's best not to set
'this script to run too close to midnight as Helm may be collecting log information at this time.
'Generally the quietest hosting time is around 6-7am.
'**********************************************************************************
Dim fso, fDomDir, fLogDir, fLog, todayDate
todayDate=cDate(day(now) &" "& MonthName(Month(Now),true) &" "& Year(Now))
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(serverName & DomainPath) Then
RaiseError "Can Not Find Domain Folder"
Else
getDomainStats
End If
set fso=Nothing
'================Functions==============
Private Sub GetDomainStats()
Dim WshShell, CABReturnCode, CABCommand
Dim fileDate
Set WshShell = WScript.CreateObject("WScript.Shell")
For Each fDomDir in fso.GetFolder(serverName & DomainPath).SubFolders
DebugOut("Checking Domain "& UCase(fDomDir.Name))
If fso.FolderExists(fDomDir.Path &"\Logs") Then
For Each fLogDir in fso.GetFolder(fDomDir.Path &"\Logs").SubFolders
For Each fLog in fLogDir.Files
If UCase(Left(fLog.Name,2))="EX" And UCase(Right(fLog.Name,4))=".ZIP" Then
fileDate=cDate(Mid(fLog.name,3,2) &" "& monthname(cint(Mid(fLog.name,5,2)),true) &" "& Mid(fLog.name,7,2))
If fileDate< DateAdd("d", toDayDate, -RemoveOlderThan) Then
DebugOut("Deleting "& flog.name)
fLog.Delete
End If
ElseIf UCase(Left(fLog.Name,2))="EX" And UCase(Right(fLog.Name,4))=".LOG" Then
fileDate=cDate(Mid(fLog.name,3,2) &" "& monthname(cint(Mid(fLog.name,5,2)),true) &" "& Mid(fLog.name,7,2))
If fileDate< DateAdd("d", toDayDate, -RemoveOlderThan) Then
DebugOut("Deleting "& flog.name)
fLog.Delete
Else
'---CAB logfile----
if fileDate < DateAdd("d", toDayDate, -ArchiveOlderTHan) Then
CABCommand = """C:\Program Files\WinRAR\rar.exe"" a " & Left(fLog.Path,Len(fLog.Path)-3) & "rar" & " " & fLog.Path
wscript.echo cabcommand
CABReturnCode = WshShell.Run(CABCommand, 7, True)
If (Err.Number <> 0) Then
RaiseError Err.Description & " (" & Err.Number & ")"
ElseIf (CABReturnCode <> 0) Then
RaiseError "Return code from WZZIP.EXE was " & CABReturnCode
Else
fLog.Delete
End If
End If
End If
'---Done---
End if
Next
Next
Else
RaiseError "Can Not Find The Log Folder"
End If
Next
Set WshShell=Nothing
End Sub
Private Sub DebugOut(strDebugText)
WScript.Echo strDebugText
End Sub
Private Sub RaiseError(strErrText)
WScript.Echo "ERROR: "& strErrText
End Sub