Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

rmtree (remove tree) example

import os, stat
import shutil

def remove_readonly(func, path, _):
    "Clear the readonly bit and reattempt the removal"
    os.chmod(path, stat.S_IWRITE)
    func(path)

shutil.rmtree(directory, onerror=remove_readonly)
Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #rmtree
ADD COMMENT
Topic
Name
5+6 =