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

get files as stat dictionary

parents e26939f2 ea3efee0
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
import os
import stat
class OsUtility:
......@@ -117,7 +118,12 @@ class OsUtility:
for f in files:
fullPath = os.path.join(dirPath, f)
if os.path.isfile(fullPath):
fDict[fullPath] = os.stat(fullPath)
statResult = os.stat(fullPath)
fileInfo = {}
fileInfo['fileSize'] = statResult[stat.ST_SIZE]
fileInfo['fileCreationTime'] = statResult[stat.ST_CTIME]
fileInfo['fileModificationTime'] = statResult[stat.ST_MTIME]
fDict[fullPath] = fileInfo
elif os.path.isdir(fullPath):
fDict = cls.findFilesAsDict(fullPath, fDict)
return fDict
......
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