-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGet_Path_Info.py
25 lines (22 loc) · 927 Bytes
/
Get_Path_Info.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
from Utils import os, save_obj
def get_iteration_location(input_path, Description='', output={}):
files = []
dirs = []
for root, dirs, files in os.walk(input_path):
break
files = [os.path.join(input_path,i) for i in files if i.find(Description + '_Iteration_') == 0]
if files:
iteration = (files[0].split('Iteration_')[-1]).split('.txt')[0]
output[iteration] = input_path
for dir_val in dirs:
output = get_iteration_location(os.path.join(input_path,dir_val),Description, output)
return output
def make_location_pickle(base_path, path, Description):
output = get_iteration_location(path, Description=Description)
key_list = list(output.keys())
for key in key_list:
output[key] = output[key].split(path)[-1].split('\\')[-1]
save_obj(os.path.join(base_path, 'Data_Locations.pkl'), output)
return None
if __name__ == '__main__':
xxx = 1