find-stignore - a quick tool to show what is being ignored

Just going to leave this here for those who want some way to see what is being ignored by their .stignore file.

https://github.com/paulhargreaves/find-stignore

You’ll need to compile yourself. Enjoy. P.S. Very happy for a real API/part of syncthing to make this unnecessary :wink:

2 Likes

Now had chance to build a Windows binary; repo now has binaries for Linux x64 (tested on Ubuntu and Centos) and Windows x64.

I am not sure this does the right thing. It seems to rely on files not being in syncthings database which might not always be true, as I suspect previously synced now ignored files will be in the database with the invalid bit set.

If I were to do this, I’d have made it a pure filesystem walk and used the syncthing/lib/ignore package to parse the ignore file and print matches.

as I suspect previously synced now ignored files will be in the database with the invalid bit set.

That doesn’t appear to be the case for the tests I did. I’d got several thousand files that were originally synced, then I added them to an ignore. That was several weeks (and version) ago. Then I looked at the database via the api and they don’t show up.

But maybe they get purged after a while? Regardless, the API documentation is pretty light on detail https://docs.syncthing.net/rest/db-browse-get.html doesn’t mention anything about ignored files or anything else.

If I were to do this, I’d have made it a pure filesystem walk and used the syncthing/lib/ignore package to parse the ignore file and print matches.

Feel free :wink: I’m sure several people would have found it useful.

More seriously though, this is my 2nd piece of go code, and the lib/ignore.go package isn’t documented - so it’s totally unclear (to me) on how to do anything with it.

Yeah that’s fair. Our internal-ish packages unfortunately aren’t really meant for public use. Here’s a quick example, without -print0 etc functionality (just give it the folder root).

Dear Jakob, Is it possible to realize your example as a part of Syncthing REST API? I really need this feature as I’d like to know if my new local file is really new or it ignored. Actually I’d like to see something like GET /rest/db/file for a new local file that does not exist in database.

Syncthing doesn’t index ignored files so, no, you can’t ask the REST API about them.