Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component


Index of Chilkat Blog Posts

February 9, 2006

Relative Paths in Zip Q/A

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


Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.