Answers for "remove folder if exist python"

9

python dlete folder

import shutil

shutil.rmtree('/folder_name')
Posted by: Guest on June-12-2020
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 "remove folder if exist python"

Python Answers by Framework

Browse Popular Code Answers by Language