Contents - Index


Creating a Zip File


 

  

Creating a new zip file is very easy with VCLZip.  Just follow these steps: 

 

Set the ZipName Property to a new filename.  It's best to include a full path!  

Add any filespecs or wildcards to the FilesList Property that you wish to be zipped.  

Set any other options that you want.  

Call the Zip Method  

  

And that's it!!!  Here's an example: 

 

With VCLZip1 do 

begin 

ZipName := 'C:\BACKUP.ZIP'; 

FilesList.Add('C:\MYFILES\*.PAS'); /* Zip all .PAS files */ 

Recurse := True; /* Recurse directories */ 

StorePaths := True; /* Keep path information */  

PackLevel := 9; /* Highest level of compression */ 

NumberZipped := Zip; /* Return value of Zip is the actual number of files zipped */ 

end; 

 

Be sure to include kpZipObj in your USES list if you set properties like OverwriteMode.  kpZipObj includes many definitions that you may use.