CreateEntries

Archive.CreateEntries method (1 of 2)

Adds to the archive all files and directories recursively in the directory given.

public Archive CreateEntries(DirectoryInfo directory, bool includeRootDirectory = true)
Parameter Type Description
directory DirectoryInfo Directory to compress.
includeRootDirectory Boolean Indicates whether to include the root directory itself or not.

Return Value

The archive with entries composed.

Exceptions

exception condition
DirectoryNotFoundException The path to directory is invalid, such as being on an unmapped drive.
SecurityException The caller does not have the required permission to access directory.

Examples

using (Archive archive = new Archive())
{
    DirectoryInfo folder = new DirectoryInfo("C:\folder");
    archive.CreateEntries(folder);
    archive.Save("folder.zip");
}

See Also


Archive.CreateEntries method (2 of 2)

Adds to the archive all files and directories recursively in the directory given.

public Archive CreateEntries(string sourceDirectory, bool includeRootDirectory = true)
Parameter Type Description
sourceDirectory String Directory to compress.
includeRootDirectory Boolean Indicates whether to include the root directory itself or not.

Return Value

The archive with entries composed.

Examples

using (Archive archive = new Archive())
{
    archive.CreateEntries("C:\folder");
    archive.Save("folder.zip");
}

See Also