I have a script in VBScript that gets the content of a folder and gets it into a zip. It is mainly based on what I found in another post, as I am no VBS expert. This is the function:
Sub ArchiveFolder (zipFile, sFolder)
With CreateObject("Scripting.FileSystemObject")
zipFile = .GetAbsolutePathName(zipFile)
sFolder = .GetAbsolutePathName(sFolder)
With .CreateTextFile(zipFile, True)
.Write Chr(80) & Chr(75) & Chr(5) & Chr(6) & String(18, chr(0))
End With
End With
With CreateObject("Shell.Application")
.NameSpace(zipFile).CopyHere .NameSpace(sFolder).Items
Do Until .NameSpace(zipFile).Items.Count = _
.NameSpace(sFolder).Items.Count
WScript.Sleep 1000
Loop
End With
End Sub
I need to divide the resulting file in size limited files (80MB). Is there a way to do this?
As I understand it, the Chr(80) & Chr(75) & Chr(5) & Chr(6) & String(18, chr(0))
part is indicating to create a zip file, but I am not able to find an explanation of what this means and how to parametrize the action.
I have finally solved it by using 7zip's portable version. There I can create the zip file with the parameters I need:
The simplest approach to limiting the size of a zip file is to continue adding files until the maximum size is exceeded, then remove the last item added.
Of course there are more intelligent strategies than this to optimize space usage, but exploring them would be far too broad for an answer here.