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.
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.
Drive letters (ex. "C:") are never stored in the Zip file regardless of how files are specified in the FilesToProcess property. However, it is possible to accomplish this by using the ZipPreprocessingFile event's Filename parameter to rename the file as it is being zipped.
If you specify files using absolute paths , the entire path to the file, except the drive or device portion, will be stored in the zip file. For example, if you specify "C:\DATA\*.*" or "\\ComputerName\ShareName\DATA\*.*" in FilesToProcess, files will be stored in the zip file without the "C:\" or "\\ComputerName\ShareName\" portion of the path.
If you specify files using relative paths , the paths are assumed to be relative to the application's current directory , unless you use the BasePath property, which lets you specify the path files are relative to. In both cases, only the relative portion of a path is stored in the zip file.
If you specify file names without paths, the files will be searched for in the current directory, or the directory specified in the BasePath property if it is used. When specifying only file names, no path information will be stored in the zip file.
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.
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.