Update split_by_size_or_qty_and_compress.py
This commit is contained in:
@@ -37,16 +37,15 @@ def split_by_size_or_qty_and_compress(files, size_limit = 1048576, qty_limit = 1
|
||||
file = files.pop()
|
||||
chunk_size += os.path.getsize(file)
|
||||
|
||||
if(chunk_size > size_limit) or (len(chunk) >= qty_limit):
|
||||
compress(chunk, "Part_" + str(part_num) + ".zip")
|
||||
chunk.clear()
|
||||
chunk_size = 0
|
||||
part_num +=1
|
||||
continue
|
||||
else:
|
||||
if(chunk_size < size_limit) and (len(chunk) < qty_limit):
|
||||
chunk.append(file)
|
||||
continue
|
||||
|
||||
|
||||
compress(chunk, "Part_" + str(part_num) + ".zip")
|
||||
chunk.clear()
|
||||
chunk_size = 0
|
||||
part_num +=1
|
||||
|
||||
if(len(chunk) > 0):
|
||||
compress(chunk, "Part_" + str(part_num) + ".zip")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user