'$~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'
'
' NAME: Clean Cache
'
' AUTHOR:
' DATE : 01/03/2013
'
' COMMENT:
'
'Exemplary damages arising out of or in any way relating to the use of this script,
'including without limitation damages for loss of goodwill, work stoppage,
'lost profits, loss of data, and computer failure or malfunction.
'You bear the entire risk as to the quality and performance of this script.
'$~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim objFSO
Dim objFolder
Dim objSubFolder
Dim winsh
Dim winenv
'deletes folders with a date modified of 7 day or older
Const intDaysOld = 7
set winsh = CreateObject("WScript.Shell")
set winenv = winsh.Environment("Process")
windir = winenv("WINDIR")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'looks for \system32\ccm\cache for 32bit
if objFSO.FolderExists (windir & "\system32\ccm\cache") Then
Set objFolder = objFSO.GetFolder(windir & "\system32\ccm\cache")
For Each objSubFolder In objFolder.SubFolders
If objSubFolder.DateLastModified < DateValue(Now() - intDaysOld) Then
objSubFolder.Delete True
End If
Next
Wscript.quit
End if
'looks for \sysWOW64\ccm\cache for 64bit
if objFSO.FolderExists (windir & "\sysWOW64\ccm\cache") Then
Set objFolder = objFSO.GetFolder(windir & "\sysWOW64\ccm\cache")
For Each objSubFolder In objFolder.SubFolders
If objSubFolder.DateLastModified < DateValue(Now() - intDaysOld) Then
objSubFolder.Delete True
End If
Next
End if
0 commenti:
Post a Comment
Give me you feedback!