Skip to content

Comments

Add --modified-within flag to limit files by last modified date in backups#4

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-3
Draft

Add --modified-within flag to limit files by last modified date in backups#4
Copilot wants to merge 2 commits intomainfrom
copilot/fix-3

Conversation

Copy link

Copilot AI commented Sep 10, 2025

This PR adds a new optional --modified-within=AGE flag to the backup command that optimizes backup performance by limiting file consideration to those modified within a specified timeframe.

Problem

The immutable-backups.sh script currently compares all files from the source directory against every previous backup, resulting in very long runtimes as the number of previous backups increases.

Solution

The new --modified-within=AGE flag:

  • Works for both full and incremental backups
  • Passes the age value as --max-age=AGE to rclone, using rclone's standard age syntax (e.g., 30d, 72h, 12w)
  • Maintains backward compatibility - when omitted, behavior is unchanged
  • Is compatible with rclone v1.55.1 and later

Examples

# Take an incremental backup considering only files modified in the last 30 days
./immutable-backups.sh backup --local=/path/to/files --remote=your-remote: --incremental --modified-within=30d --dry-run

# Take a full backup considering only files modified in the last 72 hours
./immutable-backups.sh backup --local=/path/to/files --remote=your-remote: --modified-within=72h --dry-run

Changes Made

  • Added argument parsing for --modified-within=AGE flag
  • Updated both incremental and full backup rclone commands to include --max-age when specified
  • Enhanced help text with usage documentation and examples
  • Maintained full backward compatibility

Fixes #3.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copy link
Author

Copilot AI commented Sep 10, 2025

@emmetog 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

…ckups

Co-authored-by: emmetog <1182891+emmetog@users.noreply.github.com>
Copilot AI changed the title [WIP] Add --modified-within flag to limit files by last modified date in backups Add --modified-within flag to limit files by last modified date in backups Sep 10, 2025
Copilot AI requested a review from emmetog September 10, 2025 10:10
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.

Add --modified-within flag to limit files by last modified date in backups

2 participants