Xceed Zip Compression Library Documentation
Controlling how paths are stored in the zip file
Xceed Zip control reference > Controlling how paths are stored in the zip file

Each file stored in a zip file must have a filename associated with it. A zip file can also contain path information for each file.

When zipping up files using the Zip method, you may or may not want path information stored in the zip file, or you may need to store only a portion of a path. Xceed Zip provides you with total control over how file names and paths are stored in the zip file. The different techniques you can use are described below.

Use the FilesToProcess property

In order to use the zip method, you must use the FilesToProcess property to specify the files you want to zip up. As mentioned in the FilesToProcess property topic, you can specify files to zip up either with absolute paths , relative paths or without paths at all.

Use the ZipPreprocessingFile event

Immediately before each file is actually zipped up into the zip file, the ZipPreprocessingFile event is triggered. This event provides you with the sFilename parameter, which contains the path and filename of the file about to be zipped. Modifying this parameter allows you to store any path and filename you want in the zip file.

Use the PreservePaths property

Setting the PreservePaths property to False will cause all path information to be discarded, so only the filename will be stored in the zip file.