[Original] python implements cleanup of local cache garbage and python Cache
# Coding = utf-8import osimport globtry: # Use the glob module to locate the fuzzy path File_1 = glob. glob ("C: \ Windows \ SoftwareDistribution \ DataStore \ Logs \*. jrs ") for log in File_1: if File_1! = 0: try: OS. remove (log) print "deleting redientsDataStore \ Logs" failed t OSError: print "DataStore \ Logs cant be removed" File_2 = glob. glob ("C: \ Windows \ WinSxS \ ManifestCache \*. * ") for ManifestCache in File_2: if File_2! = 0: try: OS. remove (ManifestCache) print "deleting WinSxS \ ManifestCache" failed t OSError: print "WinSxS \ ManifestCache cant be removed" File_3 = glob. glob ("C: \ Windows \ WinSxS \ Backup \*. * ") for Backup in File_3: if File_3! = 0: try: OS. remove (Backup) print "deleting WinSxS \ Backup" failed t OSError: print "WinSxS \ Backup cant be removed" File_4 = glob. glob ("C: \ ProgramData \ Microsoft \ Windows Defender \ Definition Updates \ Backup \*. * ") for DefenderBackup in File_4: if File_4! = 0: try: OS. remove (DefenderBackup) print "deleting Definition Updates \ Backup Defender" cannot t OSError: print "Definition Updates \ Backup cant be removed" File_5 = glob. glob ("C: \ ProgramData \ Microsoft \ Windows Defender \ Scans \*. * ") for Scans in File_5: if File_5! = 0: try: OS. remove (Scans) print "deleting Windows Defender \ Scans" exclude t OSError: print "Windows Defender \ Scans cant be removed" File_6 = glob. glob ("C: \ Users \ * \ Local \ Temp \ NVIDIA Corporation \ NV_Cache \*. * ") for NV_Cache in File_6: if File_6! = 0: try: OS. remove (NV_Cache) print "deleting NVIDIA Corporation \ NV_Cache" effect OSError: print "NVIDIA Corporation \ NV_Cache cant be removed" # File_7 = glob. glob ("C: \ Users \ * \ Local \ Microsoft \ Windows \ Explorer \*. db ") # for Explorer in File_7: # if File_7! = 0: # try: # OS. remove (Explorer) # print "deleting Windows \ Explorer" # export t OSError: # print "Windows \ Explorer cant be removed" File_8 = glob. glob ("C: \ Windows \ Temp \*. * ") for Temp in File_8: if File_8! = 0: try: OS. remove (Temp) print "deleting Windows \ Temp" failed t OSError: print "Windows \ Temp cant be removed" File_9 = glob. glob ("C: \ * \ Local Settings \ Temp \*. * ") for SettingTemp in File_9: if File_9! = 0: try: OS. remove (SettingTemp) print "deleting Local Settings \ Temp" failed t OSError: print "Local Settings \ Temp cant be removed" File_10 = glob. glob ("C: \ * \ Local \ TaoBrowser \ User Data \ Default \ Cache \*. * ") for TaoBrowser in File_10: if File_10! = 0: try: OS. remove (TaoBrowser) print "deleting TaoBrowser \ User Data \ Default \ Cache" failed t OSError: print "TaoBrowser \ User Data \ Default \ Cache cant be removed" finally: print "finally and enjoy" raw_input ()