Archive.CreateEntries

CreateEntries(DirectoryInfo, bool)

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

public Archive CreateEntries(DirectoryInfo directory, bool includeRootDirectory = true)
ParameterTypeDescription
directoryDirectoryInfoDirectory to compress.
includeRootDirectoryBooleanIndicates whether to include the root directory itself or not.

Return Value

The archive with entries composed.

Exceptions

exceptioncondition
DirectoryNotFoundExceptionThe path to directory is invalid, such as being on an unmapped drive.
SecurityExceptionThe 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


CreateEntries(string, bool)

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

public Archive CreateEntries(string sourceDirectory, bool includeRootDirectory = true)
ParameterTypeDescription
sourceDirectoryStringDirectory to compress.
includeRootDirectoryBooleanIndicates 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