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 tmp
and cache
.
I then run:
restic -r Docs backup --exclude="/tmp" --exclude="/cache" $HOME/Documents
But both tmp
and 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 $HOME/Documents/tmp
or tmp
.
1 Like
Oh, I thought it was almost like .gitignore
Do you know how I can only exclude top-level directories?
Yes, like in the first of the two examples given.
1 Like
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.