I have seen the new restic rewrite feature (Working with repositories — restic 0.15.2 documentation), however, documentation IMHO is a little bit lacking.
I have the following experience:
$ /usr/bin/restic -r repo rewrite --exclude ".local/share/pnpm/store/" --exclude ".local/share/virtualenv/" --path .local/ --dry
unknown flag: --dry
$ /usr/bin/restic -r repo rewrite --exclude ".local/share/pnpm/store/" --exclude ".local/share/virtualenv/" --path .local/ --dry-run
repository a72e6e8d opened (version 1)
no snapshots would be modified
$ /usr/bin/restic -r repo rewrite --exclude ".local/share/pnpm/store/" --exclude ".local/share/virtualenv/" --path h/s/.local/ --dry-run
repository a72e6e8d opened (version 1)
no snapshots would be modified
$ /usr/bin/restic -r repo rewrite --exclude "h/s/.local/share/pnpm/store/" --exclude "h/s/.local/share/virtualenv/" --path h/s/.local/ --dry-run
repository a72e6e8d opened (version 1)
no snapshots would be modified
$ /usr/bin/restic -r repo rewrite --exclude ".local/share/pnpm/store/" --exclude ".local/share/virtualenv/" --dry-run
repository a72e6e8d opened (version 1)
snapshot 004a1036 of [/h/s] at 2022-09-19 16:29:30.018029696 +0300 EEST)
excluding /h/s/.local/share/virtualenv
would save new snapshot
snapshot 00e1f3ca of [/h/s] at 2023-03-12 23:34:36.859780094 +0200 EET)
excluding /h/s/.local/share/pnpm/store
excluding /h/s/.local/share/virtualenv
would save new snapshot
snapshot 00168f5b of [/h/s] at 2022-10-06 11:52:50.918561813 +0300 EEST)
excluding /h/s/.local/share/virtualenv
signal interrupt received, cleaning up
$ /usr/bin/restic -r repo rewrite --exclude ".local/share/pnpm/store/" --exclude ".local/share/virtualenv/" --exclude ".ssh/perf-16*" --exclude "Documents/a/b/c/d"
repository a72e6e8d opened (version 1)
snapshot 00168f5b of [/h/s] at 2022-10-06 11:52:50.918561813 +0300 EEST)
excluding /h/s/.local/share/virtualenv
excluding /h/s/Documents/a/b/c/d
saved new snapshot bdcd18ba
snapshot 004a1036 of [/h/s] at 2022-09-19 16:29:30.018029696 +0300 EEST)
excluding /h/s/.local/share/virtualenv
excluding /h/s/Documents/a/b/c/d
saved new snapshot 2d8f1501
As you can see, I needed to let go of the --path
to have it working
I may be over-optimizing, but I have a “big enough repo” I thought it was warranted.