Adds specified local files or directories to a directory within the ZIP archive.

Namespace:  Rebex.IO.Compression
Assembly:  Rebex.Zip (in Rebex.Zip.dll)


Visual Basic
Public Function Add ( _
	sourcePathOrMask As String, _
	archiveDirectoryPath As String _
) As ArchiveOperationResult
public ArchiveOperationResult Add(
	string sourcePathOrMask,
	string archiveDirectoryPath


Type: System..::..String
Path (with or without a mask) to an external (local) file or directory.
Type: System..::..String
Path to an archive directory where to add files. Null reference (Nothing in Visual Basic) means root.

Return Value

Operation result.


System..::..ArgumentNullExceptionsourcePathOrMask is null.
System..::..ArgumentExceptionThe specified path is empty or contains invalid characters. -or- Illegal use of wildcards in path. -or- The system could not retrieve the absolute path.
System..::..InvalidOperationExceptionArchive is not opened for writing. -or- sourcePathOrMask refers to the ZIP archive itself.
System..::..ObjectDisposedExceptionArchive was already disposed.
System..::..NotSupportedExceptionPath is in an invalid format.
System.IO..::..PathTooLongExceptionsourcePathOrMask exceeds the maximum length defined by system. -or- The target path is longer than 65.535 characters.
System.Security..::..SecurityExceptionThe caller does not have the required permissions.
System..::..UnauthorizedAccessExceptionAccess to the file is denied.
System.IO..::..IOExceptionAn I/O error occurred.
Rebex.IO.Compression..::..ZipExceptionCannot perform the requested operation, or the operation was canceled (see ProblemType for detailed information).

Version Information

.NET Framework

Supported in: 4.8, 4.7.x, 4.6.x, 4.5.x, 4.0, 3.5 SP1

.NET Standard 2.0

Supported in: .NET Core 3.1, 3.0, 2.1; Xamarin.Android 9.1 (or higher); Xamarin.iOS 10.3 (or higher)

See Also