Archive.merge

Archive merge(Archive base, Archive other, string outDir, string mergedBase, string ext, MergeOpts mo) @safe

Merges two archives into a new combined archive.

This static factory merges a base archive with a secondary (differential or incremental) archive to produce a new merged archive. The merged archive contains the combined contents of both source archives.

Parameters

basethe base archive (typically a full backup)
otherthe secondary archive to merge (typically incremental/differential)
outDirdirectory where the merged archive slices are written
mergedBasebase name for the new merged archive
extslice extension (e.g., "dar")
momerge options specifying compression, slicing, etc.

Returns

A new Archive instance wrapping the merged archive.

Throws

DarException if merging fails (invalid archives, I/O error,

permission denied, or other libdar-reported errors).

Example:

import ddn.wrp.dar;

// Open two existing archives
auto ro = readOpts().withExtension("dar").toLow();
auto baseArc = Archive.open("/backups", "full_backup", "dar", ro);
auto incrArc = Archive.open("/backups", "incr_backup", "dar", ro);

// Merge them with compression
auto mo = mergeOpts()
             .withCompression(DarCompression.GZIP)
             .withCompressionLevel(6);
auto merged = Archive.merge(baseArc, incrArc, "/backups", "merged", "dar", mo);

Archive merge(Archive base, Archive other, string outDir, string mergedBase, string ext, MergeOptions mo) @safe

Merges two archives into a new combined archive using low-level options.

This overload accepts low-level MergeOptions directly for cases where more control is needed.

Parameters

basethe base archive
otherthe secondary archive to merge
outDirdirectory where the merged archive slices are written
mergedBasebase name for the new merged archive
extslice extension (e.g., "dar")
molow-level merge options

Returns

A new Archive instance wrapping the merged archive.

Throws

DarException if merging fails.
Archive merge(Archive base, Archive other, string outDir, string mergedBase, string ext) @safe

Merges two archives into a new combined archive using default options.

This is a convenience overload that uses default merge settings (no compression, no slicing).

Parameters

basethe base archive
otherthe secondary archive to merge
outDirdirectory where the merged archive slices are written
mergedBasebase name for the new merged archive
extslice extension (e.g., "dar")

Returns

A new Archive instance wrapping the merged archive.

Throws

DarException if merging fails.