Hi you all,
I’m having some issues with the functionality to re-include files that were previously excluded in combination with wildcards. I’m currently running this restic version: restic 0.18.1 compiled with go1.25.1 on darwin/arm64.
This is my restic command:
restic --verbose backup \
/Users/username \
--exclude-caches \
--exclude-file excludes.txt
and this the excludes.txt file:
Library
Virtual Machines*
Applications
.*
!.config
!.ssh
!Library/Application Support/PrismLauncher/instances/*/minecraft/saves/**
The re-including function works for the .config and .ssh directory but not for the last line. I made sure that files like this are existing:
/Users/username/Library/Application Support/PrismLauncher/instances/All the Mods 10- To the Sky ATM10SKY/minecraft/saves/test/icon.png
But when I run
restic ls a95a0ec5 | grep "PrismLauncher"
I get a negative result so there is no entry with PrismLauncher inside in the last snapshot. Is there a problem with the wildcards in the line or does anyone know what the problem here could be? I also tried to put /* behind the double stars because I read in the documentation that the double stars must be between path separators but this didn’t change anything.
I suspect you’re hitting this documented behavior:
It works similarly to gitignore, with the same limitation: once a directory is excluded, it is not possible to include files inside the directory.
What I think is happening is you’re ignoring Library and so restic doesn’t even descend into this directory at all.
Something like this should work:
Library/*
!Library/Application Support
Library/Application Support/*
!Library/Application Support/PrismLauncher
Library/Application Support/PrismLauncher/*
!Library/Application Support/PrismLauncher/instances
I don’t have the time to experiment at the moment to find a solution for the rest of the pattern, but this would at least get all of instances in the backup.
1 Like
Look, cdhowie has the right diagnosis. I can complete the pattern for the rest of the path.
The core rule with gitignore-style exclusions is that you have to “carve out” each parent directory step by step, you can never jump straight to re-including a deeply nested path if any ancestor directory is excluded. Restic won’t descend into an excluded directory regardless of any re-include patterns underneath it.
To get just the saves directories included while keeping everything else in Library excluded, you’d continue cdhowie’s pattern like this:
Library/*
!Library/Application Support
Library/Application Support/*
!Library/Application Support/PrismLauncher
Library/Application Support/PrismLauncher/*
!Library/Application Support/PrismLauncher/instances
Library/Application Support/PrismLauncher/instances/*
!Library/Application Support/PrismLauncher/instances/*/minecraft
Library/Application Support/PrismLauncher/instances/*/minecraft/*
!Library/Application Support/PrismLauncher/instances/*/minecraft/saves
The * in instances/* matches any single directory level (one instance name), which is standard gitignore behaviour that restic follows. The same applies to instances/*/minecraft.
One thing to be aware of: if your instance directory names contain spaces (which PrismLauncher often does), the pattern matching should still work since restic uses filepath.Match semantics in Go, which handles spaces in path components just fine.
If after making these changes the saves still aren’t appearing, try running with --verbose=3 and piping to grep PrismLauncher. This shows you exactly which files restic is evaluating and why they’re included or excluded, which makes it much easier to debug.
2 Likes