Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python remove non empty read only directory


    import os
    import stat
    import shutil
    def del_ro_dir(dir_name):
        '''Remove Read Only Directories'''
        for (root, dirs, files) in os.walk(dir_name, topdown=True):
            os.chmod(root,
                # For user ...
                stat.S_IRUSR |
                stat.S_IWUSR |
                stat.S_IXUSR |
                # For group ...
                stat.S_IWGRP |
                stat.S_IRGRP |
                stat.S_IXGRP |
                # For other ...
                stat.S_IROTH |
                stat.S_IWOTH |
                stat.S_IXOTH
            )
        shutil.rmtree(dir_name)

    if __name__ == '__main__':
        del_ro_dir('')
Comment

PREVIOUS NEXT
Code Example
Python :: rename coordinate netcdf python xarray 
Python :: find Carmichael number sage 
Python :: python3 inorder generator 
Python :: maximo numero de variables dentro de un .def python 
Python :: pair plot python 
Python :: user input dictionary python 
Python :: print no new line python 
Python :: datetime to string python 
Python :: python code to get all file names in a folder 
Python :: pathlib get list of files 
Python :: serializers.py include all fields 
Python :: rearrange list python 
Python :: numpy slice array into chunks 
Python :: element not found selenium stackoverflow 
Python :: pyspark concat columns 
Python :: urllib.error.HTTPError: HTTP Error 403: Forbidden 
Python :: how to create an empty 2d list in python 
Python :: plt ax title 
Python :: python json indented 
Python :: pandas diff between dates 
Python :: django email settings 
Python :: how to wait in pygame 
Python :: read bytes from file python 
Python :: Python program to check leap year or not? 
Python :: euclidean distance python 
Python :: how to split a string in python with multiple delimiters 
Python :: extract n grams from text python 
Python :: leaky relu keras 
Python :: python rock paper scissor 
Python :: networkx create graph from dataframe 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =