In This Topic
Xceed Zip for .NET gives you the possibility to add files to a new or existing zip file. For more information, you can refer to the Adding files to a zip file and Copying items to a zip file topics.
QuickZip Example
The following example demonstrates how to add files to a zip file using the static Zip method of the QuickZip class.
VB.NET |
Copy Code |
Imports Xceed.Zip
QuickZip.Zip( "d:\test.zip", True, True, False, "d:\file.txt" )
|
C# |
Copy Code |
using Xceed.Zip;
QuickZip.Zip( @"d:\test.zip", true, true, false, @"d:\file.txt" );
|
FileSystem Example
The following example demonstrates how to add files to a zip file using the FileSystem object model.
VB.NET |
Copy Code |
Imports Xceed.Zip Imports Xceed.FileSystem
Dim diskFolder As New DiskFolder( "c:\temp" ) diskFolder.CopyFilesTo( New ZipArchive( New DiskFile( "c:\test.zip" ) ), True, True )
|
C# |
Copy Code |
using Xceed.Zip; using Xceed.FileSystem;
DiskFolder diskFolder = new DiskFolder( @"c:\temp" );
diskFolder.CopyFilesTo( new ZipArchive( new DiskFile( @"c:\test.zip" ) ), true, true );
|
For more information, you can refer to the Adding files to a zip file and Copying items to a zip file topics.