[Root] / Xceed.Zip Assembly / Xceed.Zip Namespace / QuickZip Class / Zip Method / Zip(String,String,EncryptionMethod,Boolean,Boolean,Boolean,Int64,SplitNameFormat,SfxPrefix,DiskRequiredCallback,ByteProgressionCallback,ItemProgressionCallback,Object,String[]) Method
The fully-qualified path and name of the zip file.
The password that will be used to encrypt the files.
The EncryptionMethod used to encrypt the files. If EncryptionMethod.WinZipAes is passed, an encryption strength of 256 will be used.
Boolean value indicating whether existing files should be overwritten.
Boolean value indicating if files contained within sub-folders should be added to the zip file.
Boolean value indicating if the directory structure should be preserved in the zip file.
The size, in bytes, of each split zip file part that will be created.
The naming convention the split zip file parts will follow.
The XceedSfxPrefix used to create the self-extracting zip file.
The callback method called whenever the DiskRequired event is triggered.
Delegate for ByteProgression notification.
Delegate for ItemProgression notification.
Opaque data that will be passed back to the event handler when an event is raised.
The files to add to zipFileName. Can contain filemasks and folder names (ending with a backslash). All subfolders will also be scanned for the specified file(s) even if wildcards are not used. For example, if "C:\test.txt" is specified, all "test.txt" files found on the "C:\" drive will be added to the zip file. Folders specified with the backslash after them will include their entire contents. Cannot be a null reference (Nothing in Visual Basic).


In This Topic
    Zip(String,String,EncryptionMethod,Boolean,Boolean,Boolean,Int64,SplitNameFormat,SfxPrefix,DiskRequiredCallback,ByteProgressionCallback,ItemProgressionCallback,Object,String[]) Method
    In This Topic
    Adds files to a zip file using an encryption password and either splitting or spanning. Item or byte progression is tracked.
    Syntax
    'Declaration
     
    
    Public Overloads Shared Sub Zip( _
       ByVal zipFileName As String, _
       ByVal encryptionPassword As String, _
       ByVal encryptionMethod As EncryptionMethod, _
       ByVal replaceExistingFiles As Boolean, _
       ByVal recursive As Boolean, _
       ByVal preservePaths As Boolean, _
       ByVal splitSize As Long, _
       ByVal splitNameFormat As SplitNameFormat, _
       ByVal sfx As SfxPrefix, _
       ByVal diskRequiredCallback As QuickZip.DiskRequiredCallback, _
       ByVal byteProgressionCallback As QuickZip.ByteProgressionCallback, _
       ByVal itemProgressionCallback As QuickZip.ItemProgressionCallback, _
       ByVal userParams As Object, _
       ByVal ParamArray filesToZip() As String _
    ) 
    'Usage
     
    
    Dim zipFileName As String
    Dim encryptionPassword As String
    Dim encryptionMethod As EncryptionMethod
    Dim replaceExistingFiles As Boolean
    Dim recursive As Boolean
    Dim preservePaths As Boolean
    Dim splitSize As Long
    Dim splitNameFormat As SplitNameFormat
    Dim sfx As SfxPrefix
    Dim diskRequiredCallback As QuickZip.DiskRequiredCallback
    Dim byteProgressionCallback As QuickZip.ByteProgressionCallback
    Dim itemProgressionCallback As QuickZip.ItemProgressionCallback
    Dim userParams As Object
    Dim filesToZip() As String
     
    QuickZip.Zip(zipFileName, encryptionPassword, encryptionMethod, replaceExistingFiles, recursive, preservePaths, splitSize, splitNameFormat, sfx, diskRequiredCallback, byteProgressionCallback, itemProgressionCallback, userParams, filesToZip)

    Parameters

    zipFileName
    The fully-qualified path and name of the zip file.
    encryptionPassword
    The password that will be used to encrypt the files.
    encryptionMethod
    The EncryptionMethod used to encrypt the files. If EncryptionMethod.WinZipAes is passed, an encryption strength of 256 will be used.
    replaceExistingFiles
    Boolean value indicating whether existing files should be overwritten.
    recursive
    Boolean value indicating if files contained within sub-folders should be added to the zip file.
    preservePaths
    Boolean value indicating if the directory structure should be preserved in the zip file.
    splitSize
    The size, in bytes, of each split zip file part that will be created.
    splitNameFormat
    The naming convention the split zip file parts will follow.
    sfx
    The XceedSfxPrefix used to create the self-extracting zip file.
    diskRequiredCallback
    The callback method called whenever the DiskRequired event is triggered.
    byteProgressionCallback
    Delegate for ByteProgression notification.
    itemProgressionCallback
    Delegate for ItemProgression notification.
    userParams
    Opaque data that will be passed back to the event handler when an event is raised.
    filesToZip
    The files to add to zipFileName. Can contain filemasks and folder names (ending with a backslash). All subfolders will also be scanned for the specified file(s) even if wildcards are not used. For example, if "C:\test.txt" is specified, all "test.txt" files found on the "C:\" drive will be added to the zip file. Folders specified with the backslash after them will include their entire contents. Cannot be a null reference (Nothing in Visual Basic).
    Supported Frameworks

    .NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.

    .NET Standard: netstandard2.0, netstandard2.1

    .NET Framework: net20, net35, net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.

    See Also