forked from OminousBlackCat/NJU_SEU_sun_data_process
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getFileList.py
39 lines (33 loc) · 1017 Bytes
/
getFileList.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
import config
import os
if config.bin_count == 1:
limit_size = config.sun_row_count_bin_1
else:
limit_size = config.sun_row_count_bin_2
def getTarget(filePath):
dbtype_list = os.listdir(filePath)
target_list = []
out_list = []
if len(dbtype_list) >= limit_size:
target_list.append(filePath)
nums = filePath.split('/')
out_list.append(nums[-1].split('-')[0])
err = 0
for dbtype in dbtype_list:
try:
if os.path.isdir(filePath + dbtype):
filelist = os.listdir(filePath + dbtype)
else:
filelist = []
except IOError:
err += 1
else:
if (len(filelist)) >= limit_size:
target_list.append(filePath + dbtype)
nums = dbtype.split('/')
out_list.append(nums[-1].split('-')[0])
print(target_list)
print(out_list)
return target_list, out_list
if __name__ == "__main__":
getTarget(config.data_dir_path)