Answers for "how to delete files in a folder with python"

1

delete folders using python

import shutil
shutil.rmtree(r'Path where the folder with its files is storedFolder name')
Posted by: Guest on August-19-2021
-1

python how to delete a directory with files in it

import shutil

dir_path = '/tmp/img'

try:
    shutil.rmtree(dir_path)
except OSError as e:
    print("Error: %s : %s" % (dir_path, e.strerror))
Posted by: Guest on December-22-2020

Code answers related to "how to delete files in a folder with python"

Python Answers by Framework

Browse Popular Code Answers by Language