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

get files as stat dictionary

parent 404803bc
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python #!/usr/bin/env python
import os import os
import stat
class OsUtility: class OsUtility:
...@@ -117,7 +118,12 @@ class OsUtility: ...@@ -117,7 +118,12 @@ class OsUtility:
for f in files: for f in files:
fullPath = os.path.join(dirPath, f) fullPath = os.path.join(dirPath, f)
if os.path.isfile(fullPath): 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): elif os.path.isdir(fullPath):
fDict = cls.findFilesAsDict(fullPath, fDict) fDict = cls.findFilesAsDict(fullPath, fDict)
return fDict return fDict
......
...@@ -96,6 +96,7 @@ class ExperimentSessionControllerImpl(DmObjectManager): ...@@ -96,6 +96,7 @@ class ExperimentSessionControllerImpl(DmObjectManager):
filePathsDict = fileProcessingManager.removeHiddenFilesFromProcessing(filePathsDict, uploadInfo) filePathsDict = fileProcessingManager.removeHiddenFilesFromProcessing(filePathsDict, uploadInfo)
# Check which files need to be processed # Check which files need to be processed
filePathsDict = fileProcessingManager.checkUploadFilesForProcessing(filePathsDict, uploadInfo) filePathsDict = fileProcessingManager.checkUploadFilesForProcessing(filePathsDict, uploadInfo)
print "FILEPATHSDICT: ", filePathsDict
if not len(filePathsDict): if not len(filePathsDict):
raise InvalidRequest('There are no new files for upload in directory %s.' % dataDirectory) raise InvalidRequest('There are no new files for upload in directory %s.' % dataDirectory)
......
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