MCPcopy Create free account
hub / github.com/wal-e/wal-e / remove_empty_dirs

Function remove_empty_dirs

wal_e/blobstore/file/calling_format.py:6–12  ·  view source on GitHub ↗

removes empty dirs under a given path

(path)

Source from the content-addressed store, hash-verified

4
5
6def remove_empty_dirs(path):
7 """ removes empty dirs under a given path """
8 for root, dirs, files in os.walk(path):
9 for d in dirs:
10 dir_path = os.path.join(root, d)
11 if not os.listdir(dir_path):
12 os.rmdir(dir_path)
13
14
15def ensure_dir_exists(path):

Callers 1

delete_keysMethod · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected