def remove_empty_dirs(path):
for root, dirs, files in os.walk(path):<EOL><INDENT>for d in dirs:<EOL><INDENT>dir_path = os.path.join(root, d)<EOL>if not os.listdir(dir_path):<EOL><INDENT>os.rmdir(dir_path)<EOL><DEDENT><DEDENT><DEDENT>
removes empty dirs under a given path