Pages

Blogger Themes

To Clear the browser caches : To Clear Temp files and folders : To Clear APP caches files

"

'*************************************************************************
'  Creation and Modification Log:
 '   Date                   By                    Notes                                                        
 '   ----------           -------                 ---------
'    #Date#              G A Reddy              Created
'*************************************************************************
'*************************************************************************

'*************************************************************************
' Purpose of the script:
'*************************************************************************
'           To Clear the browser caches
'           To Clear Temp files and folders
'           To Clear APP caches files
'           To Clear Java and other cache files.

'*************************************************************************
'Set WshShell = CreateObject("WScript.Shell")
'Set WshSysEnv = WshShell.Environment("Process")
'strHomeDrive = WshSysEnv("HOMEDRIVE")
'strHomePath =  strHomeDrive + WshSysEnv("HOMEPATH")

Set WshShell = CreateObject("WScript.Shell")
strHomePath =  WshShell.ExpandEnvironmentStrings("%USERPROFILE%")

'strInternetPropPath = strHomePath
'strJavaCachePath = strHomePath + "\Application Data\Sun\Java\Deployment\cache"
'strBrowseFileCacheLocation = strHomePath + "\Application Data\APP"
'strBrowseCachePath = strBrowseFileCacheLocation+ "\BrowseCache"
'strFileCachePath = strBrowseFileCacheLocation + "\FileCache"
'strTemporaryInternetFilePath = strHomePath + "\Local Settings\Temporary Internet Files"



strInternetPropPath = strHomePath
'strJavaCachePath = strHomePath + "\Application Data\Sun\Java"
strBrowseFileCacheLocation = strHomePath + "\Application Data\APP"
strBrowseCachePath = strBrowseFileCacheLocation+ "\BrowseCache"
strFileCachePath = strBrowseFileCacheLocation + "\FileCache"
strTemporaryInternetFilePath = strHomePath + "\Local Settings\Temp"
strTemporaryInternetFilePath1 = strHomePath + "\Local Settings\Temporary Internet Files"

'msgbox strHomePath
'msgbox strTemporaryInternetFilePath

Call ClearCaches

Function ClearCaches

' Clear IE temporary file and cookies
RemoveFolderAndFiles strTemporaryInternetFilePath, False, True
'msgbox strTemporaryInternetFilePath


RemoveFolderAndFiles strTemporaryInternetFilePath1, False, True
' Delete Java cache
' Because of issues with the version on the jre (could be mutliple versions)
'and the different states of the control panel, it was decided to remove cache folders/files without using Java Control Panel.
' Engineering felt that it should not be a problem.
'RemoveFolderAndFiles strJavaCachePath, True, True
'msgbox strJavaCachePath

'Delete the Browse and File Cache files
RemoveFolderAndFiles strBrowseFileCacheLocation, True,True
'msgbox strBrowseFileCacheLocation

End Function



'************************************************************************
' Sub Name: RemoveFolderAndFiles
' Purpose: Removes Files and Folders
' Assumptions: None
' Inputs:  strFolder -  Folder to remove file/subfolders
' bLeaveFolder - Remove sub folders and all files but not main folder
' bForceDelete - Force delete
' Return Values:  Nothing
'************************************************************************
Public Sub RemoveFolderAndFiles(strFolder,  bLeaveFolder,  bForceDelete)
Dim Folder
Dim Folders
Dim Files
Dim File
Dim fso

On error Resume Next
                Set fso = CreateObject("Scripting.FileSystemObject")
    if (fso.folderExists(strFolder) = True and bLeaveFolder = False) then
        call fso.DeleteFolder(strFolder, bForceDelete)
    end if

    If (fso.folderExists(strFolder) = True and bLeaveFolder = True) then
                                Set Folder = fso.GetFolder(strFolder)

                                Set Files = Folder.Files
                                For each File in Files
                                                File.Delete
                                Next

                                Set Folders = Folder.SubFolders
                                For each Folder in Folders
                                   call fso.DeleteFolder(strFolder + "\" + Folder.Name, bForceDelete)
                                Next
    end if

On error goto 0

                Set Folder = Nothing
                Set Folders = Nothing
                Set Files = Nothing
                Set File = Nothing
                Set fso = Nothing
End Sub



'************************************************************************
'************************************************************************


"

'*************************************************************************
'  Creation and Modification Log:
 '   Date                   By                    Notes                                                        
 '   ----------           -------                 ---------
'    #Date#              G A Reddy              Created
'*************************************************************************
'*************************************************************************

'*************************************************************************
' Purpose of the script:
'*************************************************************************
'           To Clear the browser caches
'           To Clear Temp files and folders
'           To Clear APP caches files
'           To Clear Java and other cache files.

'*************************************************************************
'Set WshShell = CreateObject("WScript.Shell")
'Set WshSysEnv = WshShell.Environment("Process")
'strHomeDrive = WshSysEnv("HOMEDRIVE")
'strHomePath =  strHomeDrive + WshSysEnv("HOMEPATH")

Set WshShell = CreateObject("WScript.Shell")
strHomePath =  WshShell.ExpandEnvironmentStrings("%USERPROFILE%")

'strInternetPropPath = strHomePath
'strJavaCachePath = strHomePath + "\Application Data\Sun\Java\Deployment\cache"
'strBrowseFileCacheLocation = strHomePath + "\Application Data\APP"
'strBrowseCachePath = strBrowseFileCacheLocation+ "\BrowseCache"
'strFileCachePath = strBrowseFileCacheLocation + "\FileCache"
'strTemporaryInternetFilePath = strHomePath + "\Local Settings\Temporary Internet Files"



strInternetPropPath = strHomePath
'strJavaCachePath = strHomePath + "\Application Data\Sun\Java"
strBrowseFileCacheLocation = strHomePath + "\Application Data\APP"
strBrowseCachePath = strBrowseFileCacheLocation+ "\BrowseCache"
strFileCachePath = strBrowseFileCacheLocation + "\FileCache"
strTemporaryInternetFilePath = strHomePath + "\Local Settings\Temp"
strTemporaryInternetFilePath1 = strHomePath + "\Local Settings\Temporary Internet Files"

'msgbox strHomePath
'msgbox strTemporaryInternetFilePath

Call ClearCaches

Function ClearCaches

' Clear IE temporary file and cookies
RemoveFolderAndFiles strTemporaryInternetFilePath, False, True
'msgbox strTemporaryInternetFilePath


RemoveFolderAndFiles strTemporaryInternetFilePath1, False, True
' Delete Java cache
' Because of issues with the version on the jre (could be mutliple versions)
'and the different states of the control panel, it was decided to remove cache folders/files without using Java Control Panel.
' Engineering felt that it should not be a problem.
'RemoveFolderAndFiles strJavaCachePath, True, True
'msgbox strJavaCachePath

'Delete the Browse and File Cache files
RemoveFolderAndFiles strBrowseFileCacheLocation, True,True
'msgbox strBrowseFileCacheLocation

End Function



'************************************************************************
' Sub Name: RemoveFolderAndFiles
' Purpose: Removes Files and Folders
' Assumptions: None
' Inputs:  strFolder -  Folder to remove file/subfolders
' bLeaveFolder - Remove sub folders and all files but not main folder
' bForceDelete - Force delete
' Return Values:  Nothing
'************************************************************************
Public Sub RemoveFolderAndFiles(strFolder,  bLeaveFolder,  bForceDelete)
Dim Folder
Dim Folders
Dim Files
Dim File
Dim fso

On error Resume Next
                Set fso = CreateObject("Scripting.FileSystemObject")
    if (fso.folderExists(strFolder) = True and bLeaveFolder = False) then
        call fso.DeleteFolder(strFolder, bForceDelete)
    end if

    If (fso.folderExists(strFolder) = True and bLeaveFolder = True) then
                                Set Folder = fso.GetFolder(strFolder)

                                Set Files = Folder.Files
                                For each File in Files
                                                File.Delete
                                Next

                                Set Folders = Folder.SubFolders
                                For each Folder in Folders
                                   call fso.DeleteFolder(strFolder + "\" + Folder.Name, bForceDelete)
                                Next
    end if

On error goto 0

                Set Folder = Nothing
                Set Folders = Nothing
                Set Files = Nothing
                Set File = Nothing
                Set fso = Nothing
End Sub



'************************************************************************
'************************************************************************


0 comments:

Post a Comment

Tuesday

To Clear the browser caches : To Clear Temp files and folders : To Clear APP caches files


'*************************************************************************
'  Creation and Modification Log:
 '   Date                   By                    Notes                                                        
 '   ----------           -------                 ---------
'    #Date#              G A Reddy              Created
'*************************************************************************
'*************************************************************************

'*************************************************************************
' Purpose of the script:
'*************************************************************************
'           To Clear the browser caches
'           To Clear Temp files and folders
'           To Clear APP caches files
'           To Clear Java and other cache files.

'*************************************************************************
'Set WshShell = CreateObject("WScript.Shell")
'Set WshSysEnv = WshShell.Environment("Process")
'strHomeDrive = WshSysEnv("HOMEDRIVE")
'strHomePath =  strHomeDrive + WshSysEnv("HOMEPATH")

Set WshShell = CreateObject("WScript.Shell")
strHomePath =  WshShell.ExpandEnvironmentStrings("%USERPROFILE%")

'strInternetPropPath = strHomePath
'strJavaCachePath = strHomePath + "\Application Data\Sun\Java\Deployment\cache"
'strBrowseFileCacheLocation = strHomePath + "\Application Data\APP"
'strBrowseCachePath = strBrowseFileCacheLocation+ "\BrowseCache"
'strFileCachePath = strBrowseFileCacheLocation + "\FileCache"
'strTemporaryInternetFilePath = strHomePath + "\Local Settings\Temporary Internet Files"



strInternetPropPath = strHomePath
'strJavaCachePath = strHomePath + "\Application Data\Sun\Java"
strBrowseFileCacheLocation = strHomePath + "\Application Data\APP"
strBrowseCachePath = strBrowseFileCacheLocation+ "\BrowseCache"
strFileCachePath = strBrowseFileCacheLocation + "\FileCache"
strTemporaryInternetFilePath = strHomePath + "\Local Settings\Temp"
strTemporaryInternetFilePath1 = strHomePath + "\Local Settings\Temporary Internet Files"

'msgbox strHomePath
'msgbox strTemporaryInternetFilePath

Call ClearCaches

Function ClearCaches

' Clear IE temporary file and cookies
RemoveFolderAndFiles strTemporaryInternetFilePath, False, True
'msgbox strTemporaryInternetFilePath


RemoveFolderAndFiles strTemporaryInternetFilePath1, False, True
' Delete Java cache
' Because of issues with the version on the jre (could be mutliple versions)
'and the different states of the control panel, it was decided to remove cache folders/files without using Java Control Panel.
' Engineering felt that it should not be a problem.
'RemoveFolderAndFiles strJavaCachePath, True, True
'msgbox strJavaCachePath

'Delete the Browse and File Cache files
RemoveFolderAndFiles strBrowseFileCacheLocation, True,True
'msgbox strBrowseFileCacheLocation

End Function



'************************************************************************
' Sub Name: RemoveFolderAndFiles
' Purpose: Removes Files and Folders
' Assumptions: None
' Inputs:  strFolder -  Folder to remove file/subfolders
' bLeaveFolder - Remove sub folders and all files but not main folder
' bForceDelete - Force delete
' Return Values:  Nothing
'************************************************************************
Public Sub RemoveFolderAndFiles(strFolder,  bLeaveFolder,  bForceDelete)
Dim Folder
Dim Folders
Dim Files
Dim File
Dim fso

On error Resume Next
                Set fso = CreateObject("Scripting.FileSystemObject")
    if (fso.folderExists(strFolder) = True and bLeaveFolder = False) then
        call fso.DeleteFolder(strFolder, bForceDelete)
    end if

    If (fso.folderExists(strFolder) = True and bLeaveFolder = True) then
                                Set Folder = fso.GetFolder(strFolder)

                                Set Files = Folder.Files
                                For each File in Files
                                                File.Delete
                                Next

                                Set Folders = Folder.SubFolders
                                For each Folder in Folders
                                   call fso.DeleteFolder(strFolder + "\" + Folder.Name, bForceDelete)
                                Next
    end if

On error goto 0

                Set Folder = Nothing
                Set Folders = Nothing
                Set Files = Nothing
                Set File = Nothing
                Set fso = Nothing
End Sub



'************************************************************************
'************************************************************************


No comments:

Post a Comment