How to include specific folders based string while excluding any subfolders with specific name?

Cant seem to work out proper way to formulate this… the challenge is this:

There is about 400 project smb shares mounted on a server at /mnt. there is multipel folders for each project and each project needs to have manual contorl over retention policy. So what we figured is to create multiple backup jobs that back up same source (/mnt) but use different include-exclude patterns to give us that granual control over what goes into every backup job.

All network shares have names that follow this convention:

project1_footage
project1_projectfiles1
project1_projectfiles2
project2_footage
project2_projectfiles1
project2_projectfiles2

(except there may be 4-5 project folders and 4-5 footage folders)

Inside every folder that has “projectfiles” in it’s name, there will be a subfolder called “projectcache” and “projectcache2” - these two folder don’t need to be backed up.

so the question is, how to formulate a correct argument to back up all folders that have “project1_projectfiles” in it’s name, while excluding specifically named subfolders.

we’ve tried doing:

+*project1_projectfiles*
-*/projectcache/*
-*/projectcache2/*

But that doesn’t seem to work, everything gets backed up anyway…

any thoughts ?

Maybe something like this

+*_projectfiles/
-*_projectfiles/projectcache/
-*_projectfiles/projectcache2/
+*_projectfiles/*

The key here is that stuff ending with / matches folders. This /* matches content of the folders. Also note, * matches any symbol, including path separator