This project is read-only.

Volume Letter in Path on Zip Entry

May 24, 2009 at 6:24 PM

Hi Cheeso,

I have started a new project in vb .net using the library version

Any ideas on how I can utilise the full path i.e. c:\temp\myvid.avi in a zip entry?
This project is a backup utility and I need to be able to determine the source drive of a file, in the event of a restore.

I found by searching that pre-version 1.7 I might have been able to use the 'TrimVolumeFromFullyQualifiedPaths Property' , but this was removed:
"This property was unused and unloved, but it is worth mentioning. It was a vestige of a prior broken design where the library encoded drive letters into the zipfile. The behavior and the property are both gone now."  (Source : )

I understand why this has been removed (pretty much breaks zip files for reading with anything but your library?) but do you have a replacement method, or any ideas on how to replicate this functionality?
My own thought is to provide the original path (or volume letter)  as a comment against each entry as appropiate perhaps?
Maintaining compatability to open zip files with os/other zip programs would be great, as well as the ability to store the full path including the drive letter!
Reading between the lines, the zip format does not seem to cater for this??


May 24, 2009 at 10:41 PM

Hi Paul!

You are correct, the ZIP spec does not permit the use of the drive letter within the zipfile.   When DotNetZip stored a drive letter in the zip archive, in violation of the specification, other zip tools could not properly open and read the zipfiles.   So for that reason I removed the ability of DotNetZip to do that.

If you want compatibility with other zip tools (A good idea), then you cannot store the drive letter in the path for the file entry.  Seems like your idea to use the entry comment would work, OR, you could name the zip archive itself with the name of the volume letter, if all files in the archive are from the same drive.   You could also use the zipfile comment to specify a drive letter.


May 25, 2009 at 6:54 PM

Ok, thanks for the reply.
I appreciate your comments, shame about the ZIP spec, work-around time it is then..