Help with forgetting untagged snapshots

Hi

I have a number of tagged and untagged snapshots. I would like automate forget/prune of untagged snapshots only.

At the moment it appears I cannot specify an “untagged” snapshot, either for listing snapshots, or forget. It’s either lists everything, or a selection of known tags.

Based on my reading, I would have to list all snapshots, collect all possible tag names, then add --keep-tag=<tag list> to my forget command.

Is this correct? or an I doing something wrong?

Thanks

There does not appear to be any way to match all untagged snapshots, so I have submitted a pull request to support such a feature.

It’s really simple to filter out the snapshots that have no tags using jq, run the restic snapshots command and pipe the output through jq -r '.[] | select(has("tags") | not).id' to get the list of snapshots that contains no tags.

As an update, I’m thinking my policy needs to change to ensure all backups are tagged with something.

It makes much more sense to tag my system backups and apply policy to that tag directly.

Thanks.