Python Forum

Full Version: Problem with remove Temp Files
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone!

I try to remove the tempfiles in windows 8... I try with Python:

--------------------------------------------------------------------------------------------
import os
# Confirm the current working directory 
os.getcwd()
# use '\\' while chaning the directory 
os.chdir("C:\\") 

os.system('del *.tmp /s /f')
or

import os
os.system("cd.. & cd.. & del *.tmp /s /f")
or

import os
os.remove('C:/Users/XYZ/AppData/Local/Temp')
... say: PermissionError: [WinError 5] Acceso denegado: 'C:/Users/XYZ/AppData/Local/Temp'

--------------------------------------------------------------------------------------------

...but it is not running... can you help me please?

Regards
Karlo
Hello! There is an error message - PermissionError. Run the script with administrative privileges