This is probably something Fabrice can answer? (as FabZip is based on DotNetZip).
I use DotNetZip for creating zips. It has many option but I couldn't find if it is possible to store the disk where the file is located, in the archive. E.g. like the Absolute mode in 7-Zip. As far as I can see I can only do this:
Hi Dick,
If I get you right, your goal is to store the "original" disk (and path may be) in the Zip File ?
I would think that this is not possible per design : You always store relative's path of file.
And I think this is good : Imagine zipping a file stored originally on a Y: drive, trying to unzip it... when you don't have a Y drive ?
That said, You (as a developer) can inject some informations within the ZipFile (the container), or per file inside the Zip, in order to keep that info :
The ZipFile and the ZipEntry classes have a property named Comment. You can store here any information you would find usefull in String format, so... It's up to you
Hi Dick,
the zip file format does not defines drives, it allows only to store the drive label.
On other platforms than Windows (and DOS) there is no drive, only folders.
So this is not a problem of DotNetZip, but of the zip format.
And as Fabrice wrote: it would be very risky to restore to the same drive letter: immagine you are saving from a USB drive on one machine and the restore would overwrite a network drive or a local disk on a different machine.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Thanks for your replies. I think it is a 7-Zip feature, see picture. I select Absolute pathnames and when opening the zip in Explorer it is empty but in 7-Zip you see first the disk and then the directory.
I think this is better, because now selecting a file with the same name on c:temp and d:temp means the latter won't be added in the zip. And you can restore in a different disk. But I also think it would be hard to achieve as it is not standard supported in DotNetZip.
7zipincludingdisk.jpg (44.69 KiB) Viewed 611 times
EDIT: I actually didn't try what would happen if I add the same file(name) residing in the same directory for 2 different disks.
Turns out that both files are added, with the same name in the same directory. Open each of the files and you see the different content. So I think it's indeed a good idea to check out the comment option, to at least show from which disk the files were.
var zipEntry=zip.AddFile(cFileFull, cPath);
zipEntry.Comment=cPath.Substring(0,1);
In a program like 7-zip you can see the comment, being the drive letter, and this is then the only difference if I add 2 exactly the same files in the same directory.