ArchiveHandle for the created archive.createArchive
fn
ArchiveHandle createArchive(string fsRoot, string outDir, string base, string ext, CreateOptions co) @safeCreates an archive (full backup) writing slices to the given output directory.
This function creates a new DAR archive containing all files and directories under the specified filesystem root. The archive is written as slice files to the output directory.
Parameters
fsRoot | filesystem root to back up (all files under this path are archived) |
outDir | directory where archive slices are written |
base | archive base name (slices will be named base.1.ext, base.2.ext, etc.) |
ext | slice extension (typically "dar") |
co | create options created via CreateOptions.create() |
Returns
Throws
DarException if archive creation fails (permission denied, disk full,
invalid options, I/O errors).
Example:
// Create a simple uncompressed backup
auto co = CreateOptions.create();
auto archive = createArchive("/home/user/documents", "/backups", "docs", "dar", co);
// Create a compressed, encrypted backup
auto co2 = CreateOptions.create();
co2.setCompression(DarCompression.GZIP);
co2.setCompressionLevel(6);
co2.setCryptoAlgo(DarCryptoAlgo.AES256);
co2.setPassword("mysecretpassword");
co2.setAllowOverwrite(true);
auto secureArchive = createArchive("/data", "/backups", "secure_backup", "dar", co2);