Skip to content

Feature: Add --structure flag for RESTORE to control output path style #52

@djdarcy

Description

@djdarcy

Summary

Currently, RESTORE mirrors the backup's directory structure (respecting the original --rel, --abs, --flat choice). Users should have control over the restored structure independent of how the backup was organized.

Proposed Feature

Add a --structure (or -str) flag to RESTORE with the following options:

Value Behavior
dst Default - Mirror the destination/backup structure (current behavior)
orig Restore to original source paths as recorded in the manifest
rel Use relative path structure
abs Use absolute path structure (with drive letter as directory)
flat Flatten all files into a single directory

Usage Examples

# Current behavior (default: dst)
preserve RESTORE --src backup/ --dst restored/
# Result: mirrors backup structure

# Restore to original locations recorded in manifest
preserve RESTORE --src backup/ --structure orig

# Restore with absolute path structure
preserve RESTORE --src backup/ --dst restored/ --structure abs
# Result: restored/C/data/file.txt

# Restore flat
preserve RESTORE --src backup/ --dst restored/ --structure flat
# Result: restored/file.txt (all files in root)

Technical Considerations

  • Manifest already stores original source paths - this enables orig mode
  • orig mode should work without --dst (restores directly to original locations)
  • Other modes require --dst to avoid overwriting original files
  • Conflict handling (--on-conflict) should apply to all structure modes

Context

This complements the existing path preservation options (--rel, --abs, --flat) used during COPY/MOVE by giving equivalent control during RESTORE operations.

See discussion in README.md section "Understanding RESTORE --dst Behavior" for current behavior documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions