dheerajreddy926
Programmer
Hello All,
I am not a vb expert . I am planing to do an automation to delete log archives periodically from a location.we have around 100+ servers . I have got a VB script to delete folders based on path given .But i want the script to delete all archive folders in all servers . the path for Windows machines are \\srvrname\d$\sea77\siebsrvr\LOGARCHIVE and for AIX it is \\srvrname\Siebel\enterprises\siebel_aix\srvrname\logarchive.
Script i got for deleting logarchive for a particular server is
.............................................................
Const strPath = "D:\path"
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Call Search (strPath)
WScript.Echo"Done."
Sub Search(str)
Dim objFolder, objSubFolder, objFile
Set objFolder = objFSO.GetFolder(str)
For Each objFile In objFolder.Files
If objFile.DateLastModified < (Now() - 3) Then
objFile.Delete(True)
End If
Next
For Each objSubFolder In objFolder.SubFolders
Search(objSubFolder.Path)
' Files have been deleted, now see if
' the folder is empty.
If (objSubFolder.Files.Count = 0) Then
objSubFolder.Delete True
End If
Next
End Sub
------------------------------------------------------------------
I want to schudule this job every midnight so that it clears logarchives in all servers which are 3 days old .
Thanks in advance!
Dheeraj.
I am not a vb expert . I am planing to do an automation to delete log archives periodically from a location.we have around 100+ servers . I have got a VB script to delete folders based on path given .But i want the script to delete all archive folders in all servers . the path for Windows machines are \\srvrname\d$\sea77\siebsrvr\LOGARCHIVE and for AIX it is \\srvrname\Siebel\enterprises\siebel_aix\srvrname\logarchive.
Script i got for deleting logarchive for a particular server is
.............................................................
Const strPath = "D:\path"
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Call Search (strPath)
WScript.Echo"Done."
Sub Search(str)
Dim objFolder, objSubFolder, objFile
Set objFolder = objFSO.GetFolder(str)
For Each objFile In objFolder.Files
If objFile.DateLastModified < (Now() - 3) Then
objFile.Delete(True)
End If
Next
For Each objSubFolder In objFolder.SubFolders
Search(objSubFolder.Path)
' Files have been deleted, now see if
' the folder is empty.
If (objSubFolder.Files.Count = 0) Then
objSubFolder.Delete True
End If
Next
End Sub
------------------------------------------------------------------
I want to schudule this job every midnight so that it clears logarchives in all servers which are 3 days old .
Thanks in advance!
Dheeraj.