-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcreate_tools.py
More file actions
27 lines (24 loc) · 862 Bytes
/
create_tools.py
File metadata and controls
27 lines (24 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import os.path
EXCLUDES = ["src", "node_modules"] #Basic bootstrap
STARTING_FOLDER = "/"
def get_all_dirs(directory, parent_folder=""):
"""
Utility to get all directories recursively in a file system
"""
directories = []
try:
base_folder = os.path.join(parent_folder, directory)
for d in os.listdir(base_folder):
if d.startswith("."):
continue
d = os.path.join(directory, d)
full_dir = os.path.join(parent_folder, d)
if full_dir.replace(STARTING_FOLDER, "") in EXCLUDES:
continue
if os.path.isdir(full_dir):
directories.append(d)
directories = directories + get_all_dirs(d, parent_folder=parent_folder)
except OSError, aeError:
print "Error"
return directories