Skip to content

New Feature: dynamically replacing files during packaging - #259

Open
MakeDecisionWorth wants to merge 2 commits into
MaxMaeder:masterfrom
MakeDecisionWorth:feature/backup-replace
Open

New Feature: dynamically replacing files during packaging#259
MakeDecisionWorth wants to merge 2 commits into
MaxMaeder:masterfrom
MakeDecisionWorth:feature/backup-replace

Conversation

@MakeDecisionWorth

Copy link
Copy Markdown
Contributor

This feature only applies to Path-type backups (not Glob or single-file backups). It allows dynamically replacing files inside the zip archive during packaging.

One application on my server: using a custom-built Java agent to intercept the H2 database connection URL, then writing a plugin that listens for DriveBackupV2's backup events, connecting to the H2 database ahead of time to export the data. This works great for backing up databases used by plugins like LuckPerms, and avoids the issue on Windows where some local databases can't be backed up due to exclusive file locks. Of course, there's likely more to explore with this feature.

Usage:

...
blacklist:
  - ...
replace:
  - file: <file to be replaced>
    with: <replace with this file>
  - file: <another file>
    with: <replace with>

Under replace, each entry defines a pair: file is the path (relative to the backup source) of the file that would normally be included in the zip, and with is the path to the file that should be packaged in its place. Multiple pairs can be listed to replace several files in the same backup.

MakeDecisionWorth and others added 2 commits July 23, 2026 12:23
Allows a `path` backup-list entry to declare `replace: [{file, with}]`
pairs, substituting a stand-in file (e.g. an exported copy of a
locked database) for the original when zipping, while keeping the
original file name inside the archive.

Validates `file`/`with` against traversal and absolute paths, resolves
symlinks to ensure replacement sources stay within the backup location,
and skips replacements that would pull in the local backup storage
folder itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant