Skip to content
Snippets Groups Projects
Commit e77cd661 authored by sveseli's avatar sveseli
Browse files

add function to find files and return dict format

parent 9111e4f5
No related branches found
No related tags found
No related merge requests found
......@@ -103,6 +103,25 @@ class OsUtility:
fList = cls.findFiles(fullPath, fList)
return fList
@classmethod
def findFilesAsDict(cls, dirPath, fileDict=None):
""" Find files in a given directory. Return dictionary of
absolute paths.
Do not follow symbolic links.
"""
fDict = fileDict
if not fDict:
fDict = {}
if os.path.isdir(dirPath):
files = os.listdir(dirPath)
for f in files:
fullPath = os.path.join(dirPath, f)
if os.path.isfile(fullPath):
fDict[fullPath] = os.stat(fullPath)
elif os.path.isdir(fullPath):
fDict = cls.findFilesAsDict(fullPath, fDict)
return fDict
@classmethod
def importNameFromFile(cls, name, filePath):
""" Import specified name from file. """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment