Python Forum
Problem with remove Temp Files - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Problem with remove Temp Files (/thread-5892.html)



Problem with remove Temp Files - karlo_ds - Oct-26-2017

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


RE: Problem with remove Temp Files - wavic - Oct-26-2017

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