Question:
I would like to create a zip file that includes the relative paths. I call AppendOneFileOrDir with a file name of “folder\filename”. Only the filename is included in the zip file. If I set saveExtraPath to true, I get the full path to the file. Is there a property I can set to just include the path I supply to the zip file?
Answer:
Here are two possibilities:
(in VBScript, but the same methods/properties apply in .NET, VB6, C++, etc.)
zip.NewZip "myZip1.zip"
zip.AppendFiles "abc/x.txt*",0
zip.WriteZipAndClose
zip.NewZip "myZip2.zip"
zip.PathPrefix = "abc/"
zip.AppendOneFileOrDir "abc/x.txt",0
zip.WriteZipAndClose