Is there a size limit for a .zip file using CopyHere in VBScript?

寵の児 提交于 2019-12-23 04:31:04

问题


I have a vbscript that extracts multiple zip files to different locations. The code works for all but one file. This one file, that doesn't work, happens to be bigger than 6GB. The next, biggest, file that I am processing is around 3.5GB.

Here's a snippet of the code;

strFileDest = "path\to\some\dir1"
strZIPname = "file1.zip" 
Call UnPack(strFileDest, strZIPname)

strFileDest = "path\to\some\dir2"
strZIPname = "file2.zip" 
Call UnPack(strFileDest, strZIPname)

Function UnPack(strZIPdest, strZIPname)
  Dim intOptions, objShell, objSource, objTarget

  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objShell = CreateObject("Shell.Application")
  sSourceFile = objFSO.GetAbsolutePathName(strZIPname)
  Set objSource = objShell.NameSpace(sSourceFile).Items()
  Set objTarget = objShell.NameSpace(strZIPdest)

 intOptions = 256
 If objFSO.FolderExists(strZIPdest) Then
   objTarget.CopyHere objSource, intOptions
 Else
   MsgBox "Cannot complete unzip for " & strZIPname & ". The destination _
   directory (" & strZIPdest & ") could not be located.", 0, "Invalid"
 End If
End Function


I have taken a smaller zip and renamed it as the zip that won't copy. With the new size, the script will unzip that file proving that the rest of the script for that file works. I have also verified that the zip is valid by manually extracting it. When I run the script with it pointing at the large zip, I receive no errors either (I'm not using On Error resume next).


回答1:


Yes there is. As far as I know it's around 2GB, though it's undocumented I've encountered it before. If you need to compress something larger than that, use the command line version of 7zip.

Here is a VBScript wrapper I wrote for 7zip.




回答2:


From windows Vista, zip64 is supported for reading. But creation of compressed folders seems to be limited to classic zip format. 4GB max file size, 65535 entries in zip file. And microsoft has documented problems in windows xp for compressed folders larger than 2GB.



来源:https://stackoverflow.com/questions/20009033/is-there-a-size-limit-for-a-zip-file-using-copyhere-in-vbscript

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!