Use ignore patterns to sync only certain files of one folder

A have a little trouble getting ignore patterns to sync the right files :confused: Syncthing runs on Windows with a folder like this

syncthing
 - prefix-abc1-suffix.jpg
 - prefix-abc2-suffix.jpg
 + folder A
   - prefix-abc1-suffix.jpg
   - prefix-abc2-suffix.jpg
   - prefix-abc1-suffix.mpg
   - prefix-abc2-suffix.mpg
   - prefix-def1-suffix.jpg
   - prefix-def1-suffix.mpg
 + folder B
   - prefix-abc1-suffix.jpg
   - prefix-abc2-suffix.jpg
 + folder C
   - prefix-ghi1-suffix.jpg
   - prefix-jkl2-suffix.jpg

I want to sync all images that match *abc*.jpg but only from folder A no files should be synced from syncthing folder root or any other folders (e.g. folder B, folder C, etc.), even if the match the pattern or have the same images

Thanks! :slight_smile:

I think this should work:

!/folder A/*abc*.jpg
!/folder A
*

Thanks, I tried this - it’s close but not correct

expected

+ folder A
  - prefix-abc1-suffix.jpg
  - prefix-abc2-suffix.jpg

but this is result

+ folder A
  - prefix-abc1-suffix.jpg
  - prefix-abc2-suffix.jpg
  - prefix-abc1-suffix.mpg
  - prefix-abc2-suffix.mpg
  - prefix-def1-suffix.jpg
  - prefix-def1-suffix.mpg

Any ideas?

You might need to add: /folder A/* after or before: !/folder A

but my gut feeling says that the initial version should have worked.

Working solution

!/folder A/*abc*.jpg
/folder A/*
!/folder A
*

1st line includes wanted files in wanted folder, 2nd line excludes all other files in this folder, 3rd line includes wanted folder itself (otherwise 1st line would not work) 4th line excludes rest

It’s somehow logical but confusing :unamused: and heavy on user’s brain :slight_smile:

3 Likes