Useful .stignore Patterns

Thanks for this. For Adobe Lightroom I started getting lots of sync errors concerning the preveiews.db files, so I suggest the following (not perfect and surely can be improved):

// Adobe Lightroom previews.db *Previews.lrdata root-pixels.db

// Adobe Lightroom previews.db *Previews.lrdata root-pixels.db

should be:

//–Adobe Lightroom previews.db --//

*Previews.lrdata root-pixels.db

1 Like

Here’s a list with all the above recommendations, without comments.

(?d).DS_Store
.DocumentRevisions-V100
(?d)Icon*
.Spotlight-V100
.TemporaryItems
.Trashes
.fseventsd
(?d).localized
.iCloud
(?d)._*
(?d)desktop.ini
(?d)Thumbs.db
(?d)$RECYCLE.BIN
.Trash-*
(?d).@__thumb
(?d).AppleDB
(?d)@eaDir
(?d).stignore
(?d).stfolder
(?d)*.*.sw[a-p]
.dropbox
.dropbox.attr
(?d)~*
.directory
.cache
*Previews.lrdata root-pixels.db

Hi there! Is it possible to ignore linux hidden files/folders with maybe:

.*

I mean all file/folder starting with “.”

I was thinking to sync all documents from /home/myaccount/ but do not sync all account config files which are usually hidden (.firefox etc…)

I mean all file/folder starting with “.”

Not a good idea because not all “dotted” files/folders are unnecessary. Take for example .htaccess, which is normal in a web development environment and basically mandatory for anything Apache related. Loosing a .htacess file would be huge. There are many other examples as well.

5 posts were split to a new topic: Ignore patterns that start with “#”

Hi,

There are too many types of files to ignore according the various OS used. I’ve a mix a win, linux, qnap, syn… So I prefer to forbid everything and only accept the kind of file I want to share (like for firewall rules).

// allow OneOnlyFile.TxT

(?i)!OneOnlyFile.TxT

// exclude any.JpG from forbid

(?i)!*.jpg

// forbid all rest (included subdirectories : Not Tested) yet

**

Hi, I’am new with Syncthing an I need help with settings .stignore

I have 3 devices, phone 1, phone 2 and PC. I have one folder (for example folder name A and subfolders X, Y, Z). Phone 1 sync folder A with phone 2 (between these devices, sync all data in folder A both sides) and this folder I want sync with PC too, but in PC have folder A many others files and folders. I don’t want sync these other data from PC to phone 1 and 2, but I want still sync changes in folder A from phone 1 or 2 to PC (ofcourse changes only for data from phone 1 or 2 not for other data in folder A in PC)

example:

phone 1 → A/X

        /Y

        /Z

phone 2 → A/X

        /Y

        /Z

PC → A/X

   /Y

   /Z

   /P

   /Q

   /R

   /1.jpg

   /123.apk

   ...

add file or folder C/audio.mp3 in phone 1 or 2 to A → changes will be sync in phone 1 and 2 and PC.

phone 1 → A/X

        /Y

        /Z

        /C/audio.mp3

phone 2 → A/X

        /Y

        /Z

        /C/audio.mp3

PC → A/X

   /Y

   /Z

   /C/audio.mp3

   /P

   /Q

   /R

   /1.jpg

   /123.apk

   ...

Other data from PC /P, /Q, /R, /1.jpg, /123.apk … not sync to phone 1 and 2

And my next question, is it possibe to sync from PC in A only new added data to phone 1 and 2?

example: “old” data from PC /P, /Q, /R, /1.jpg, /123.apk … not sync to phone 1 and 2. But when I add new data (folder or file) sync olny this data to phone 1 and 2?

I hope you understand me and apologise for bad english :slight_smile: Thank you for help

You should just ignore folders you don’t want synced from the PC to the phones on the PC.

Can someone please explain this to a noob? So I have to put those lines in .stignore (in every node & every folder I sync with that node) .stignore. But where do I put .stglobalignore? In the root folder of syncthing? On debian its my home folder/.config/syncthing.

1 Like

This would be relative to the folder root so you’d have to do it per folder.

Huh, sorry I am confused now. The folder root is where .stignore already needs to be: in the root of the folder(s) added to syncthing for syncing.

Why create two files in each root folder (.stingore and .stglobalignore)? That does not make sense right?

I just need to exclude (globally for all devices, nodes and folders) all those Windows .thumbs and desktop.ini and Android .thumbnails folders.

EDIT: I understand now: stglobalignore and stignore should be in the root folder that is added to syncthing. stglobalignore will be synced to other devices as described below this overview: https://gist.github.com/jult/e2eaedad6b9e29d95977fea0ddffae7d

1 Like

Please do not use relative ignores escaping the folder root, that might not work in future releases.

1 Like

hi , I have a similar use case . The background being that I use the Macosx environment (macosx Catalina)for syncing my original photo’s and videos to my PC laptop as a photo dump . I use the native picture management app called “photos.app”. this generates quite a lot of files not required to be synced .

I have tried using the fancy filters in the .stignore file however had problems with the expression <!> used to ignore the ignore pattern. ST was still syncing files other than the ones used . I think the reason is that the include feature works with the include and not otherwise . so I went about a simple way

I used the the following to include the desired format (each expression per line) !.png !.mp4 !.mov !.jpg !.jpeg !.avi !*.gif

and then I used a generic expression like this <.1> <.2> (…extend to the full series) <.a> <.b> (…extend to the full series)

this helped me get the right mix . the following expression is not likely to work .

!.png !.mp4 !.mov !.jpg !.jpeg !.avi !*.gif *

this ends up ignoring everything . I don’t know if that a bug or a feature or a limitation etc.

Because I use Syncthing and Resilio in parallel, for the Ignore lists I use as follow:

Including in Syncthing Ignorelist:

// Resilio .sync .syncID .syncIgnore .syncArchive *.bts !sync *.syncPart *.syncTemp *.syncOld

Including in Resilio Ignorelist:

// Syncthing .stfolder .stignore .stversion .syncthing* .syncthing.* .syncthing.. ~syncthing~..tmp *.Identifier

In this way is possible to have a folder in both peer lists, if needed in special cases.

how could i add the Synology Dsikstation folder “#recycle” to the ignore list? the fildername starts with an “#”

Thank you in advance

If it’s at the top of your folder, /#recycle is an option. (?i)#recycle is another which matches everywhere, case insensitively.

1 Like

I want to discuss a possible case. If I want to sync a folder but not the subfolders, I have to ignore ALL subfolders. For that / in the stignore should be work.

Is possible, that sub-folders under root level will still be created on the other remote peers (folders) and they are all empty and nothing inside them, so maybe I have just a bunch of empty sub-folders?

Further, is possible, if someone accidently delete or modify the empty folders on the remote peer sides, which were not allowed to be synced, then on the server side the original folders content lots important files, will also be deleted real quick? Maybe, because Syncthing considered that folder is no longer exist and removed it?

Maybe helps, if I had some files or folders don’t wanna to be synced, simply prefix a ~ to these folders, and they will disappear like a charm on other peers. No need to add rules into the stignore. Just prefix a ~ to ignore. Is possible to use this method on almost any folder / files?

I’d try /*/** which should match everything one level down or more.

Yep.

No. Syncthing will try, complain that the folder is not empty, and suggest that maybe you have an ignore setup like described here.

I’m not sure how you mean this to work exactly.

This should be useful!

One that should be included: “.thumbnails”, used by Android, if you share just the “DCIM” directory on an Android phone you’ll get one of those included too, so best not to sync that

1 Like