Forum Discussion
ucuber
8 years agoOccasional Contributor
Aside the fact, that the question is a little bit older, here a solution in python for chrome I made for my tests. If you have some ideas to make it more elegant or effective or if you see errors, feel free to refactor it
Remark: on my system all the chrome stuff is in Roaming, so I use AppData instead of LocalAppData
def clear_stored_info_chrome():
excluded_items = [item.upper() for item in [
r"Preferences",
r"Origin Bound",
r"Extension"
]
]
found_items = [item.upper() for item in glob.glob(
os.path.join(
aqEnvironment.GetEnvironmentVariable("AppData"),
r"Google\Chrome\User Data\Default\*"
)
)
]
for item in found_items:
is_excluded = [True for tag in excluded_items if tag in item]
if not is_excluded:
try:
if os.path.isdir(item):
shutil.rmtree(item, ignore_errors=True)
else:
os.remove(item)
except BaseException as e: # I ignore errors of any kind, just a remark to Log
Log.Message("clear chrome stored info: {} - {}".format(item, e))