Sync only latest files with .stignore and script

My goal is to sync only the latest files from device A to device B (that does not have sufficient space to hold the complete dataset). Until Syncthing gets additional ignore settings (#2491) in the future, I decided to put together a script as a workaround. So far it does:

:white_check_mark: create list of recently changed files (device A)
:white_check_mark: update .stignore file (device B)
:white_check_mark: start scan via API (device B) - needed to reload .stignore file
:white_check_mark: start scan via API (device A)

The .stignore file looks like this

!FileA
!FileB
!FileC
*

over time it changes to

!FileB
!FileC
!FileD
!FileE
*

:thinking: There is one problem: as FileA is removed from the list, it is ignored by *
But it should automatically be removed from device B or the disk will fill up over time.

Any ideas how to solve this? Thanks!

How about putting the ignore patterns in an #include file which you sync between the two devices, and then setting up a script on B to run periodically and delete everything not listed there?

2 Likes