python remove directory not empty
import shutil
shutil.rmtree('/folder_name')
shutil.rmtree('/folder_name', ignore_errors=True) # for read only files
python remove directory not empty
import shutil
shutil.rmtree('/folder_name')
shutil.rmtree('/folder_name', ignore_errors=True) # for read only files
python delete directory even if not empty
# Delete everything reachable from the directory named in 'top',
# assuming there are no symbolic links.
# CAUTION: This is dangerous! For example, if top == '/', it
# could delete all your disk files.
import os
for root, dirs, files in os.walk(top, topdown=False):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
os.rmdir(os.path.join(root, name))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us