Answers for "python if directory exists delete"

0

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)
Posted by: Guest on July-20-2021

Code answers related to "python if directory exists delete"

Python Answers by Framework

Browse Popular Code Answers by Language