date/age ignore pattern

Hi Syncthing gurus! Thanks for making such a great product!

As a power user who frequently uses an /Archive* subfolder in my ignore patterns to store older files/folder that I wish not to sync to the clients any longer.

Would it be possible to have a date-based ignore pattern? This could be defined similar to a -mtime or -atime or -ctime in a unix find command. It could be a tag on a specific sub-folder/path.

A global filter for all members in the folder:

  • -mtime +30d

For a specific sub-folder:

Videos/* -ctime +1h

Forgive me if has already been posted/shared.


1 Like

I don’t see any technical blocker to prevent such a thing, but I think it might be confusing in practice.

Let’s say we have the -mtime +30d ignore filter on a new folder we just added. It’s straightforward what happens: files not modified in the last 30 days are ignored and not scanned, not sent to other devices, etc. A file that is 29 days old will be scanned and sent as normal.

Next day that file is now too old and gets ignored. This doesn’t have any effect as all clients are already up to date and have synced it.

If that file changes at any point (including being deleted) it will get a new mtime and no longer match the ignore pattern, so it will be scanned and sent anyway. The effect of the whole thing is roughly null.

I guess it’s more useful in the other direction (incoming updates) as we can then skip pulling down old files…

While I’ve put in this request elsewhere, and hence won’t elaborate too much on it, an approach for automatically limiting the amount of data that is synced to a client device that is starting to become more widely implemented is the concept of a cached virtual filesystem, which, rather than discerning specifically by dates, keeps the most recently accessed files synced on the client, up to an amount of disk space determined by the user, while keeping other files listable. I would admit, though, that which approach gives you a better hit ratio might be dependent on usage patterns.

What about a modification of the OP’s idea that would borrow from both concepts. The idea would be that the date-based ignore (or include) pattern would download and sync files less than a certain age, as suggested, but it would be “sticky” in that files older than that age would not become excluded and un-synced unless the total disk usage of all synced files went above a user-defined threshold? This would avoid things like everything becoming excluded if there are no new files added within 30 days (to go with the example above). It might be a way of achieving some of the advantages of a cached virtual filesystem by making a small change to the include/exclude feature.

The main thing you would lose compared to a virtual filesystem is the ability to show/list files that aren’t currently synced, but maybe it would be an interim approach that’s easier to implement ??

I also need a time-based ignore pattern, but I’d suggest a much simpler one:

Ignore based on date. Date types can include created and modified date, and you specify an exact date, and ignore things that are either older or newer than that.

For example, I want to sync a photo gallery but leave out photos that are older than a certain date. I could specify that if the modified date is older than XXXX-XX-XX, the file should be ignored.

I believe this doesn’t suffer from the complexities outlined above by @calmh.

I’d like to see this as well and like to add my use case: I use syncthing to sync my photos from my phone to my picture server with the following requirements:

  1. never have a photo on the phone and not on the server (apart from not being synced yet)
    → always sync all changes, including deletions, on the server down to phone
  2. two use cases for deleting photos on the phone:
  • it is misbegotten: it get’s deleted within few days after shooting
    → sync the deletion up to the server
  • phone is nearly full: oldest photos (severeal months) get deleted
    → don’t sync the deletion to the server

Now, the descision between 2.1 and 2.2 could be easily made by age-dependent sync rules, the photos of these two cases are always several months apart. I don’t sort out bad photos on the phone, if they are old. For old photos, I do this only on the server (with a web-GUIed photo management software).

So, I’d really like to see this feature.