Skip to content

Instantly share code, notes, and snippets.

@kylexlau
kylexlau / del_empty_dirs.py
Created January 6, 2012 05:31
Python delete empty directories, recursive algorithm
import os
def del_empty_dirs(s_dir,f):
b_empty = True
for s_target in os.listdir(s_dir):
s_path = os.path.join(s_dir, s_target)
if os.path.isdir(s_path):
if not del_empty_dirs(s_path):
b_empty = False