How to: Archive a Directory
To archive a directory, do the following:
- Create a ZipArchive class instance.
- Use its ZipArchive.AddDirectory method to specify the source directory.
- Call the ZipArchive.Save method to create an archive and save it to a specified location.
using DevExpress.Compression;
public void ArchiveDirectory() {
string path = this.startupPath;
using (ZipArchive archive = new ZipArchive()) {
archive.AddDirectory(path);
archive.Save("Documents\\ArchiveDirectory.zip");
}
}