synching one folder different files to individual locations?

On my Android phone in the Camera folder there are .jpg and .mp4 mixed together. Synching them to my windows pc I’d like to have the .jpg (and .dng) files in a subfolder under the user folder “pictures” and the .mp4 files in a subfolder under the user folder “videos”.

source: /storage/emulated/0/DCIM/Camera

picture destination: c:\users\andy\pictures\phone

video destination: c:\users\andy\videos\phone

Is this possible (and how)?

Yes it is, but it’s not the most standard and obvious procedure: On android create two Syncthing folders both at /storage/emulated/0/DCIM/Camera. While doing so, use ignore patterns (https://docs.syncthing.net/users/ignoring.html) to exclude anything but jpgs (and dngs) in one and anything but mp4s in the other. Then share those two folders to windows and choose the desired two separate destinations. See below.

ummm… when creating a Syncthing folder with ignore patterns it creates an .stignore file in the root of that folder. If I create another Syncthing folder in that same folder won’t it overwrite the first .stignore file and therefor dismiss the first ignore rules?

I tried to make a Syncthing folder in the DCIM folder for the pictures to have the .stignore located there and then create another Syncthing folder in the DCIM/Camera folder just for the *.mp4 Apparently ignore rules of nested folders don’t work independently but conditional on another. If in the DCIM folder I exclude anything but *.jpg and *.dng and in the DCIM/Camera folder I exclude anything but *.mp4 it works for the picture sync but no video will be synced due to the exclusions in the .stignore file located in the DCIM folder.

Oh, I think I got it :partying_face:

I shared the DCIM folder and the DCIM/Camera folder, both without any ignore rules. On the receiver end I accepted the offer to add the DCIM older, pasted in the path of the windows folder to sync with and set up the ignore rules (anything but *.jpg and *.dng) on the windows pc(!) before saving the settings. Then I accepted the DCIM/Camera folder to add, pasted the other windows folder and set up the ignore rules anything but *.mp4 before saving the settings.

The important part was to apply the ignore rules on the receiver side (windows pc) and not on the sharer side. Now happily synching pictures to “pictures” and videos to “videos” :grin:

Andy

PS: It would be great if I could reuse a shared folder to sync to another location instead of having two nested shared folders which effectively share the same content.

PPS: thought again about your post sharing the same folder twice. As I’m not applying any ignore rules on the sharer side I did give it a try and it works. Now evoiding the nested folder thing, still having to create two shared folders on the sharer side, don’t I?

ignore rules used for pictures:

!*.jpg
!*.dng
/RAW/*
!/RAW
*

and for videos:

!*.mp4
*

This whole technique (sharing a folder twice with distinct folders supported by ignore rules on the receive side) is awesome and should be documented somewhere in the official docs imho, but obviously that brings up issues with people assuming it’s hassle free and somehow guaranteed by the devs.

1 Like

Oh no, this is clearly a hack. That doesn’t mean it can’t be very worthwhile, but it’s most certainly not going to be officially documented (it probably also falls under the nested folder stuff, that we explicitly call unsupported and potentially dangerous).

1 Like

I agree on “this is a hack” and it’s nothing I would recommend either to include in official docs, but maybe in the HowTo section.

And I found another way without sharing the same folder twice. :joy:

  1. Creating a shared folder on the windows pc “phonepics” with path c:\users\andy\pictures\phonepics, setting up the ignore rules to accept *.jpg and *.dng (and maybe subfolders you’d like to have) but nothing else. Under extended set folder type to “receiving only” (for initial sync)
  2. On the Android phone accept to add folder phonepics and link it to /storage/emulated/0/DCIM/Camera, set folder type to “send only”.
  3. Creating a shared folder on the windows pc “phonevids” with path c:\users\andy\videos\phonevids, setting up ignore rules to accept *.mp4 but nothing else.
  4. On the Andoid phone accept to add folder phonevids and link it to /storage/emulated/0/DCIM/Camera, set folder type to “send only”
  5. After the initial sync has been done the folder types on both sides can be changed to “send&receive” if you want to.

As the .stignore files are only on the windows pc and resides in two different folders which are not nested or in any other correlation this method should be safe to use.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.