-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_manifest.py
46 lines (38 loc) · 1.46 KB
/
get_manifest.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
import os, re
'''
For the given path, get the List of all files in the directory tree
'''
def getListOfFiles(dirName):
# create a list of file and sub directories
# names in the given directory
listOfFile = os.listdir(dirName)
allFiles = list()
# Iterate over all the entries
for entry in listOfFile:
# Create full path
fullPath = os.path.join(dirName, entry)
# If entry is a directory then get the list of files in this directory
if os.path.isdir(fullPath):
allFiles = allFiles + getListOfFiles(fullPath)
else:
allFiles.append(fullPath)
return allFiles
def main():
dirName = '.';
# Get the list of all files in directory tree at given path
# listOfFiles = getListOfFiles(dirName)
# Print the files
# for elem in listOfFiles:
# print(elem)
# print ("****************")
# Get the list of all files in directory tree at given path
listOfFiles = list()
for (dirpath, dirnames, filenames) in os.walk(dirName):
listOfFiles += [os.path.join(dirpath, file) for file in filenames]
listOfFiles.sort()
# Print the files
for elem in listOfFiles:
if not ( elem.endswith('py') or elem.endswith('pyc') or elem.endswith('pyd') or elem.endswith('md') or elem.startswith('./working/')):
print("\"" + elem + "\",")
if __name__ == '__main__':
main()