Exclude folders but not files with the same name

I’m having difficulty crafting some exclude patterns. Would someone be able to help me out?

I want to exclude bin folders under a parent folder. For example, the below folders should be excluded

/home/user/parent/bin
/home/user/parent/foo/bin
/home/user/parent/foo/bar/bin

However, I don’t want to exclude files named bin under the parent folder. For example, the following file should be included:

/home/user/parent/baz/bin

Is there a way to distinguish between files and folders in the file provided to --exclude-file? I’ve been using /home/user/parent/**/bin, but I think that will exclude files as well, correct?

There’s no way to distinguish between folders and files in exclude patterns, as these are applies before restic knows whether something is a file or folder.

However you could use a pattern like /home/user/parent/**/bin/* which will exclude all files within bin folders.

1 Like

Thanks, that works for me!