Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python delete directory if exists

import os
import shutil

dirpath = os.path.join('dataset3', 'dataset')
if os.path.exists(dirpath) and os.path.isdir(dirpath):
    shutil.rmtree(dirpath)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #delete #directory #exists
ADD COMMENT
Topic
Name
3+9 =