mohanad Posted December 27, 2013 Report post Posted December 27, 2013 I am trying to find a best way to clear the ccm cash folder , i found some script to do that, but i want to share it with you,any idea? ------------------------------------------------------ Dim objFSODim objFolderDim objSubFolderDim winshDim winenv 'deletes folders with a date modified of 120 day or olderConst intDaysOld = 120set winsh = CreateObject("WScript.Shell")set winenv = winsh.Environment("Process")windir = winenv("WINDIR")Set objFSO = CreateObject("Scripting.FileSystemObject")'looks for \system32\ccm\cache for 32bitif objFSO.FolderExists (windir & "\system32\ccm\cache") ThenSet objFolder = objFSO.GetFolder(windir & "\system32\ccm\cache")For Each objSubFolder In objFolder.SubFolders If objSubFolder.DateLastModified < DateValue(Now() - intDaysOld) Then objSubFolder.Delete True End IfNext Wscript.quitEnd if'looks for \sysWOW64\ccm\cache for 64bit if objFSO.FolderExists (windir & "\sysWOW64\ccm\cache") ThenSet objFolder = objFSO.GetFolder(windir & "\sysWOW64\ccm\cache") For Each objSubFolder In objFolder.SubFolders If objSubFolder.DateLastModified < DateValue(Now() - intDaysOld) Then objSubFolder.Delete True End IfNextEnd if ------------------------------------------------- Thanks in advance Quote Share this post Link to post Share on other sites More sharing options...