MCPcopy
hub / github.com/nsonaniya2010/SubDomainizer / getRecursiveFolderData

Function getRecursiveFolderData

SubDomainizer.py:127–152  ·  view source on GitHub ↗

This function will get all the files path (including filename) recursively, given root folder. Parameters ---------- rootfolder : str Root folder in which all files are present. Returns ---------- dict dict of files path and their data. int

(rootfolder)

Source from the content-addressed store, hash-verified

125
126
127def getRecursiveFolderData(rootfolder):
128 """
129
130 This function will get all the files path (including filename) recursively, given root folder.
131
132 Parameters
133 ----------
134 rootfolder : str
135 Root folder in which all files are present.
136
137 Returns
138 ----------
139 dict
140 dict of files path and their data.
141 int
142 total number of (only) files within the root folder.
143 """
144 folderData = dict()
145 for filename in glob.iglob(rootfolder + '**/**', recursive=True):
146 if os.path.isfile(filename):
147 with open(filename, 'r') as file:
148 try:
149 folderData[filename] = file.read()
150 except UnicodeDecodeError:
151 pass
152 return folderData, len(folderData)
153
154
155def getUrlsFromFile():

Callers 1

SubDomainizer.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected