Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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))
Source by linuxize.com #
 
PREVIOUS NEXT
Tagged: #python #delete #directory #files
ADD COMMENT
Topic
Name
2+6 =