Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python remove empty folders

import os
def drop_empty_folders(directory):
    """Verify that every empty folder removed in local storage."""

    for dirpath, dirnames, filenames in os.walk(directory, topdown=False):
        if not dirnames and not filenames:
            os.rmdir(dirpath)
Comment

python remove directory not empty

import shutil

shutil.rmtree('/folder_name')
shutil.rmtree('/folder_name', ignore_errors=True)  # for read only files
Comment

PREVIOUS NEXT
Code Example
Python :: stop server django programmatically 
Python :: pytorch open image 
Python :: first 2 terms 
Python :: loop through groupby pandas 
Python :: flask how to run app 
Python :: how to add time with time delta in python 
Python :: maximizar ventana tkinter python 
Python :: how to send audio with inline telebot 
Python :: open tiff image pyt 
Python :: remove scientific notation python matplotlib 
Python :: number of times a value occurs in dataframne 
Python :: linux python install 
Python :: write set to txt python 
Python :: how to enable matplotlib in notebook 
Python :: edge detection opencv python 
Python :: python plot cut off when saving figure 
Python :: pyspark import stringtype 
Python :: calculator in one line in python 
Python :: iterative binary search python 
Python :: increase pie chart size python 
Python :: python push into array if not exists 
Python :: code hand tracking 
Python :: what is ycor in python turle 
Python :: download maninder in python gui 
Python :: requirements.txt flask 
Python :: how to make an encryption program in python 
Python :: sha256 pandas 
Python :: rezing images of entire dataset in python 
Python :: per gjera te shumta. Python 
Python :: pandas datetime to date 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =