I am working on a python script in which i am trying to delete all the files which are there within the given folder , though few errors like below are acting as a road block due to which the code is not able to complete.
PermissionError: The process cannot access the file because it is being used by another process: C: \\users\\dhoni\\AppData\\Local\\Temp\\2735ad90-sfa3-412f-b6b1-54534646ff3.tmp'
my question is using shutil library how can i delete all the files from a specific folder or it is possible to delete files from two different folders ?
Tried the below code
`
import shutil
import os
location = r"C:\Users\dhoni\AppData\Local"
dir = "Temp"
path = os.path.join(location, dir)
shutil.rmtree(path)`