-
Notifications
You must be signed in to change notification settings - Fork 0
/
geckoFileUtils.py
45 lines (30 loc) · 872 Bytes
/
geckoFileUtils.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
import os, sys, glob
def findFiles(folder, file_list):
folder_list = []
lst = glob.glob("%s/*" % (folder))
for f in lst:
if os.path.isfile(f):
file_list.append(f)
else:
folder_list.append(f)
for fol in folder_list:
findFiles(fol, file_list)
def findFolders(folder, intput_folder_list):
tmp_folder_list = []
lst = glob.glob("%s/*" % (folder))
for f in lst:
if not os.path.isfile(f):
intput_folder_list.append(f)
tmp_folder_list.append(f)
for fol in tmp_folder_list:
findFolders(fol, intput_folder_list)
def findFoldersInLeaf(folder, intput_folder_list):
tmp_folder_list = []
lst = glob.glob("%s/*" % (folder))
for f in lst:
if not os.path.isfile(f):
tmp_folder_list.append(f)
if len(tmp_folder_list) == 0:
intput_folder_list.append(folder)
for fol in tmp_folder_list:
findFoldersInLeaf(fol, intput_folder_list)