Time Machine: Is it possible to exclude 5000+ files via TMUTIL? Is there a limit to the number of files which can be excluded in TimeMachine?

I have 5000+ photos on an external drive along with their associated sidecar files.  The photos are large and never change (I back them up separately) but I need to backup the sidecar files.  The photos and sidecar files need to be located in the same directory

So, I thought I would just exclude the photos using TMUTIL.  I thought I could do it with one command for the whole directory structure.  That didn't work.  So I did it by year which worked at first but I seem to be reaching a limit (Around 1315) and when I try to  exclude just a few, i get the error:
Insufficient privileges to change exclusion setting.
(Although I don;t think it's anything to do with privileges).

Does anyone have any advice please…?

Many thanks, Karen
If there are hard limits, sorry, I don't know what they are however I have many exclusions set for Time Machine and one in particular has 294,691 files in it.  So instead of doing it folder by folder try setting the exclusion from Options... in Time Machine under System Preferences.

Plug in the external drive and then either drag and drop the parent folder containing the files you want to exclude or the drive icon into the Exclude these items from backups: list area or use the [+][-] buttons.