File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -878,15 +878,25 @@ def __init__(self, errorReason):
878
878
def __str__ (self ):
879
879
return self .errorReason
880
880
881
+ # Split archives are usually something like 'test.7z.001', 'test.7z.002' or 'test.zip.013'
882
+ split_file_regex = re .compile (r'\.(\d+)$' )
883
+
881
884
def extractOrCopyFile (filename , sourceFolder , destinationFolder , copiedOutputFileName = None ):
882
885
makeDirsExistOK (destinationFolder )
883
886
sourcePath = os .path .join (sourceFolder , filename )
884
887
885
888
if '.7z' in filename .lower () or '.zip' in filename .lower ():
889
+ split_extension = split_file_regex .search (filename .lower ())
890
+ if split_extension :
891
+ split_archive_number = int (split_extension .group (1 ))
892
+ # Assume archive numbers start at 1
893
+ # Only process split archives where the index is '1', ignore all others as they will be processed automatically
894
+ if split_archive_number != 1 :
895
+ return
896
+
886
897
monitor = SevenZipMonitor ()
887
898
if sevenZipExtract (sourcePath , outputDir = destinationFolder , lineMonitor = monitor ) != 0 :
888
899
raise SevenZipException ("{}\n \n Could not extract [{}]" .format (monitor .getErrorMessage (), sourcePath ))
889
-
890
900
else :
891
901
try :
892
902
shutil .copy (sourcePath , os .path .join (destinationFolder , copiedOutputFileName if copiedOutputFileName else filename ))
You can’t perform that action at this time.
0 commit comments