Sync directory as subdirectory of another synced folder

I have a syncthing folder DCIM and Pictures. I want to sync them between devices.

Peer A - android

Peer B - debian

I need to sync the contents of ~/DCIM on A to ~/Pictures/ on peer B.

E.g if ~/DCIM has Camera, then on peer B it should be in ~/Pictures/Camera/

At the same time, I want to sync the contents of ~/Pictures between A and B.

The problem is, since ~/DCIM folders live inside of it, I need to exclude them from syncing from ~/Pictures/ e.g Camera. I could not figure out a way to do it and it causes me trouble when new device was added.

I can’t tell what the problem is that you need help with. Perhaps you can clarify?

I edited the original post, I hope it’s clear now?

Sounds like you can do what you propose and add Camera to the ignore patterns on B

This is basically what I do on a couple of my peers. Works fine.

I still do not get the result I want. I tried many things… let me outline my setup in detail.

Device A - redfin

Device B - debian

When saying folder I mean the syncthing folder, when saying directory I mean the filesystem directory.

DCIM folder on A at ~/DCIM syncs to B at ~/Pictures.

Pictures folder at ~/Pictures on A syncs to Pictures folder at ~/Pictures on B.

As I said before, I want the contents of ~/Pictures directory and its subdirectories not sync to ~/DCIM.

Let me outline the directory hierarchy:

DCIM/

    Camera

Pictures/

     Albums – private life
     Screenshots
     Support material

I do not want any subdirectory of Pictures to sync to DCIM. Based on the following from Ignoring Files — Syncthing v1.29.6 documentation

Please note that directory patterns ending with a slash some/directory/ matches the content of the directory, but not the directory itself. If you want the pattern to match the directory and its content, make sure it does not have a / at the end of the pattern.

I tried including the ignore patterns Pictures or Pictures/ or DCIM and DCIM/ matching with or without case sensitivity in all the locations – one at a time and all at once.

The result is still the same. Pictures subdirectories go to DCIM, and if I delete them inside DCIM, they get deleted in Pictures as well!

Please help. I hope it’s clear.

I still need help with this.

Show your actual configs and screenshots please, I’m not following how what you show here aligns with what you wanted in post #1.

I think what is posted in #1 can be safely omitted as previous post was meant to be comprehensive. I didn’t want to create a new topic to flood the forum.

Device A: redfin

Device B: debian

DCIM

.stignore

(?d)*.DS_Store
.trashed*
.gs*
.thumbnails
// Ignore DCIM and its contents
DCIM
.localized

Pictures

(?d)*.DS_Store
.trashed*
.gs*
.thumbnails
// Ignore DCIM and its contents
DCIM
.localized

I know the ignore patterns are in both locations and not only on more, e.g DCIM. I tried with one only too. Let me know if you have questions.

Ouch… I think you are really making it hard/impossible for yourself. This is definitely a non-standard (and maybe unsupported) scenario.

IIUC, on device A you are sharing “~/DCIM”, which contains “Camera”. That is the only content in “~/DCIM” you are interested in, I think.

I recommend that you do NOT share “~/DCIM”, but instead share “~/DCIM/Camera”. And on device B you use directory “~/Pictures/Camera” for this folder. I think this will spare you a lot of hazzle. Good luck!

2 Likes

I finally got this to work…

It was hard for me and there was a lot of weird behaviour but given some understanding of syncthing and testing different setups this is not that complex.

Indeed, adding Camera to ignore patterns is enough. My problem was adding too many ignore patterns and not thoroughly analysing what I’m doing.

Thanks!

3 Likes