xxxxxxxxxx
import os
import shutil
def main():
temp_dir = os.environ.get("TEMP")
for root, dirs, files in os.walk(temp_dir):
for name in files:
try:
os.remove(os.path.join(root, name))
except Exception as e:
print(f"Error deleting file {os.path.join(root, name)}: {e}")
for name in dirs:
try:
shutil.rmtree(os.path.join(root, name))
except Exception as e:
print(f"Error deleting folder {os.path.join(root, name)}: {e}")
print("Cleanup complete!")
if __name__ == "__main__":
main()