Python Forum
Problem with remove Temp Files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with remove Temp Files
#1
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
Reply
#2
Hello! There is an error message - PermissionError. Run the script with administrative privileges
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Deleting Windows temp folder Raysz 7 454 Apr-02-2024, 12:36 PM
Last Post: Raysz
  Remove tag several xml files mfernandes 5 3,857 Sep-20-2022, 01:42 AM
Last Post: Pedroski55
  pyspark creating temp files in /tmp folder aliyesami 1 5,026 Oct-16-2021, 05:15 PM
Last Post: aliyesami
  Help with storing temp data for each day then recording min/max in app. trthskr4 3 2,431 Sep-10-2021, 10:51 PM
Last Post: trthskr4
  How to save Matplot chart to temp file? Morkus 2 4,542 Jun-12-2021, 10:52 AM
Last Post: Morkus
  Rename Multiple files in directory to remove special characters nyawadasi 9 6,428 Feb-16-2021, 09:49 PM
Last Post: BashBedlam
  remove files from folder older than X days kerzol81 2 8,663 Jan-03-2020, 11:55 PM
Last Post: snippsat
  Get system info from PI (cpu load and temp) korenron 2 2,104 Aug-04-2019, 08:45 AM
Last Post: korenron
  temp analysis Simba 13 5,916 Apr-25-2019, 09:13 PM
Last Post: Simba
  Problem with executing 2 .py files PardodeCela 1 1,696 Apr-11-2019, 07:07 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020