Suppose I want to backup
/home/user/Documents into a repository called
Docs. But I don’t want some subfolders in the
Documents directory, say
I then run:
restic -r Docs backup --exclude="/tmp" --exclude="/cache" $HOME/Documents
cache are getting backed up.
The documentation on excludes states: “Patterns are tested against the full path of a file/dir to be saved, even if restic is passed a relative path to save”. In your case you’ll need to use
Oh, I thought it was almost like
Do you know how I can only exclude top-level directories?
Yes, like in the first of the two examples given.
I was referring to excluding folders without explicitly giving the full path to the folders. Like in
.gitignore where you give
/tmp to ignore a tmp folder/file in root directory.
This isn’t currently possible. There’s an open feature request that you might like to subscribe to.