LinuxCommandLibrary

rdiffdir

Create and apply reverse diff directories

SYNOPSIS

rdiffdir [OPTIONS] OLD_DIR NEW_DIR [DIFF_FILE]

PARAMETERS

-v
    Enables verbose output, showing progress and details during the diff creation process.

-z
    Compresses the output diff file, reducing its size at the cost of increased CPU usage during diff creation and patching.

-f
    Forces the creation of the diff file, overwriting any existing file with the same name without prompting.

-l
    Enables 'lame' mode, which avoids using random files for temporary diff operations. Useful for NFS shares but not recommended for optimal performance or security.

-t TMP_DIR
    Specifies an alternative directory (TMP_DIR) for storing temporary files during the diff generation. Defaults to /tmp.

-x EXCLUDE_LIST
    Excludes files and directories matching any of the regular expressions provided in EXCLUDE_LIST from the diff operation.

OLD_DIR
    The path to the original or older version of the directory tree.

NEW_DIR
    The path to the newer or updated version of the directory tree.

DIFF_FILE
    The name of the output binary diff file. If omitted, defaults to rdiffdir.diff in the current directory.

DESCRIPTION

rdiffdir is a utility designed to compute and generate a binary difference (diff) between two specified directory trees: an OLD_DIR and a NEW_DIR. It operates by recursively traversing both directories, identifying changed, added, or removed files. For files that have been modified, it internally uses the rdiff utility to create a binary diff at the file level. The output is a single, compact binary diff file (by default rdiffdir.diff) that encapsulates all the changes necessary to transform OLD_DIR into NEW_DIR. This mechanism is particularly useful for efficient storage, backup, and transmission of directory updates, as only the changes, rather than the entire new version, need to be stored or sent. The binary nature of the diff makes it applicable to any file type, not just plain text. It is typically part of the rdiff package, distinct from rdiff-backup.

CAVEATS

rdiffdir is distinct from rdiff-backup; they serve different purposes. This utility is part of the older rdiff package and might not be actively maintained or widely available in modern Linux distributions. While it creates binary diffs, these can still be large for directories with many or heavily modified files. Its usage of regular expressions for exclusion can also be complex to manage correctly.

USAGE PATTERN

rdiffdir generates a binary diff file between two directories. To reconstruct the newer directory from the old one using this diff, the separate rdiffpatchdir utility is typically used.

Example:
1. Create a diff: rdiffdir /path/to/old_dir /path/to/new_dir changes.rdiff
2. Apply the diff: rdiffpatchdir /path/to/old_dir /path/to/reconstructed_new_dir changes.rdiff

HISTORY

rdiffdir belongs to the rdiff suite, a set of tools focused on generating binary diffs of files and directories. Developed primarily in the early 2000s, it aimed to provide a compact way to represent changes between directory snapshots. Its direct utility has somewhat waned with the advent of more versatile tools like rsync for synchronization and other dedicated backup solutions, but it remains a classic example of a direct binary differencing approach for directory trees.

SEE ALSO

rdiff(1), rdiffpatchdir(1), diff(1), rsync(1)

Copied to clipboard