import os
import shutil
for root, dirs, files in os.walk(r"C:\Users\Shivji\AppData\Local\Temp"):
for file in files:
path = os.path.abspath(os.path.join(root, file))
os.remove(path)
for dir in dirs:
path = os.path.abspath(os.path.join(root, dir))
shutil.rmtree(path)