lunedì 18 dicembre 2017

Centralino IP PBX su Windows - 3CX Phone System which links here: http://www.3cx.it/centralino/index.html

 

 

RSS Feed RSS Feed

Login

Newsletter Newsletter

Registrati

RisorseGuide e Articoli

 

31

Questo script può tornare molto utile quando non si ha a disposizione molto spazio su HD, e si vuole eliminare automaticamente i log, più vecchi di una certa data, di IIS.

 

Option Explicit

Dim DaysOld, strObjTopFolderPath, LogFileExt, ObjFS, ObjTopFolder
Dim ObjW3SvcFolder, ObjSubFolder, ObjLogFile, ObjFile

DaysOld = 7
strObjTopFolderPath = "E:\logs\WWW\"
LogFileExt = ".log"

Set ObjFS = CreateObject("Scripting.FileSystemObject")
Set ObjTopFolder = ObjFS.GetFolder(strObjTopFolderPath)

    For Each ObjW3SvcFolder in ObjTopFolder.SubFolders
        Set ObjSubFolder = ObjFS.GetFolder(ObjW3SvcFolder)
            For each ObjLogFile in ObjSubFolder.files
                Set ObjFile = ObjFS.GetFile(ObjLogFile)
                If datediff("d",ObjFile.DateLastModified,Date()) > DaysOld and lcase(right(ObjLogFile,4))=strLogFIleSuffix then
                    WScript.Echo("Stò cancellando il file " & ObjSubFolder.name & "\" & ObjFile.name)
                    ObjFile.Delete
                End If
                Set ObjFile = nothing
            Next
        Set ObjSubFolder = nothing
    Next

Set ObjTopFolder = nothing
Set ObjFS = nothing


Scritto in: Script
AZIONI: E-mail | Permalink |
CONDIVIDI: del.icio.us   Facebook   Digg   Google   Live Bookmarks   Newsvine   StumbleUpon   Technorati   Yahoo   DotNetKicks
blog comments powered by Disqus

Copyright 2011 by SysAdmin.it