-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeTreeDir.py
82 lines (70 loc) · 2.02 KB
/
makeTreeDir.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import os,glob
from config import ROOT_DATA,ROOT_APPS
#Config
OUTPUT_TXTTOCSV = 'csv_structured'
OUTPUT_CSVTOFCSV = 'csv_fixacion'
OUTPUT_FCSVTOFGRAPH = 'fixacion_graph'
INPUT_CSVTOCSVHEAT = 'csv_heat'
OUTPUT_CSVTOHMGRAPH = 'heat_map_graph'
OUTPUT_NFIXTABLE = 'n_fix_table'
OUTPUT_SACADE = 'sacadas'
ACUMULADA = 'acumulada_graph'
ACUMULADA_DOTS = 'acumulada_graph_dots'
DEFAULT_DIRECTORIES = ['input_txt',
OUTPUT_TXTTOCSV,
OUTPUT_CSVTOFCSV,
OUTPUT_FCSVTOFGRAPH,
OUTPUT_CSVTOHMGRAPH,
INPUT_CSVTOCSVHEAT,
OUTPUT_NFIXTABLE,
OUTPUT_SACADE,
ACUMULADA,
ACUMULADA_DOTS]
common_prefix = 'saeb'
comp = common_prefix
LAYER_2 = ['dados']
#LAYER_2 = [comp+'_2',comp+'_4']
#LAYER_1 = os.listdir('/home/lordwaif/documents/dados_eye/Coleta')
LAYER_1 = os.listdir('/home/lordwaif/documents/eye_leo/Entrega Piaui/')
BG_MAP = {
comp+'_2':['4','5','6'],
comp+'_4':['10','11','12']
}
main_dir = 'Coleta'
def createTreeDict():
dirs = dict()
for i in LAYER_1:
dirs[i] = dict()
for j in LAYER_2:
dirs[i][j] = DEFAULT_DIRECTORIES
return dirs
dirs = createTreeDict()
def cdCreate(path):
if not(os.path.exists(path)):
os.mkdir(path)
os.chdir(path)
def createTree():
os.chdir(ROOT_APPS)
cdCreate(ROOT_DATA)
cdCreate(main_dir)
def recursive_createTree(dirs):
for key,value in dirs.items():
cdCreate(key)
if type(value) == dict:
recursive_createTree(value)
else:
for i in value:
if not(os.path.exists(i)):
os.mkdir(i)
os.chdir('../')
recursive_createTree(dirs)
def clearFolder(path):
folders = glob.glob(path)
for folder in folders:
for file in os.listdir(folder):
if file[::-1].split('.')[0][::-1] == 'txt':
continue
os.remove(os.path.join(folder,file))
...
#clearFolder("/home/lordwaif/documents/eye_leoTree/Coleta/*/dados/acumulada_graph_dots/")
#createTree()