Commit 8de3710b authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Fixed total file size calcution.

parent 435b6022
Loading
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -131,6 +131,8 @@ class RetrieveExecutor(TaskExecutor):
                md5calc = Checksum()
                if os.path.isdir(srcPath):    
                    for root, dirs, files in os.walk(srcPath, topdown = False):
                        dirSize = os.stat(root).st_size
                        self.totalSize += dirSize
                        for f in files:
                            fullPath = os.path.join(root, f)
                            if md5calc.fileIsValid(fullPath):                            
@@ -142,6 +144,7 @@ class RetrieveExecutor(TaskExecutor):
                                               "fileSize": fileSize, 
                                               "vospaceRootParent": vospacePath 
                                           }
                                self.totalSize += fileSize
                                self.fileList.append(fileInfo.copy())
                else:
                    if md5calc.fileIsValid(srcPath):
@@ -153,8 +156,9 @@ class RetrieveExecutor(TaskExecutor):
                                       "fileSize": fileSize,
                                       "vospaceRootParent": vospacePath
                                   }
                        self.totalSize += fileSize
                        self.fileList.append(fileInfo.copy())
                
            self.logger.info(f"Total size of files to retrieve: {self.totalSize} B")
            # debug block...    
            #if os.path.exists("fileList.txt"):
            #    os.remove("fileList.txt")
@@ -179,7 +183,7 @@ class RetrieveExecutor(TaskExecutor):
                blockSize = 0
            for fileInfo in self.fileList:
                fileSize = fileInfo["fileSize"]
                self.totalSize += fileSize
                #self.totalSize += fileSize
                # check if the file is larger than a block size
                if fileSize > self.maxBlockSize:
                    # if the current block is not empty, "close" it, otherwise