Skip to main content

How to: Archive a Directory

To archive a directory, do the following:

  1. Create a ZipArchive class instance.
  2. Use its ZipArchive.AddDirectory method to specify the source directory.
  3. Call the ZipArchive.Save method to create an archive and save it to a specified location.

View Example

using DevExpress.Compression;
        public void ArchiveDirectory() {
            string path = this.startupPath;
            using (ZipArchive archive = new ZipArchive()) {
                archive.AddDirectory(path);
                archive.Save("Documents\\ArchiveDirectory.zip");
            }
        }