Global state different from local state

Do you insist putting (?i)!*.pdf instead of suggested !(?i)*.pdf

PS : 4 white space on lines biginning to post blocks (will preserve * also)

1 Like

Yes, because I didn’t try “your” solution as it’s not the way it is presented into the refered online help for exclude file : https://docs.syncthing.net/users/ignoring.html A pattern beginning with a (?i) prefix enables case-insensitive pattern matching. (?i)test matches test, TEST and tEsT. The (?i) prefix can be combined with other patterns, for example the pattern (?i)!picture*.png indicates that Picture1.PNG should be synchronized.

I didn’t even though of trying it :wink: Edit : But I’ve tried with and without (?i) yesterday; it doesn’t change the behaviour concerning the subdir exploration. So it’s not the problem I think.

1 Like

! is your major aim, i.e. do not exclude. Then any case (?i)*.pdf. Then exclude all remaining, * on a new line

What you did seems to ignore case of files named !blahblah.pdf i.e. having a ! as first character, then do exclude them.

Then the final * excludes all remaining, i.e. everything as surely you have not even a single !*.pdf in your [sub]folders

No, I tried with only 20 files and 3 folder to be sure what is or wasn’t included in the share. To ease the trial, I omit the (?i). When I had understood it, only then reintroduce it at last step, checking its action. That part is correct I’m 100% sure. I don’t have any file beginning with a ! and the share were ok. Here is my final version that works :

(?i)!/English/user/folder1/*.pdf
(?i)/English/user/folder1/*
(?i)!/English/user/folder1
(?i)!/English/user/folder0
(?i)/English/user/*
(?i)!/English/user
(?i)!/English/*.pdf
(?i)/English/*
(?i)!/English
(?i)!/French/*.pdf
(?i)/French/*
(?i)!/French
(?i)!/Dutch/*.pdf
(?i)/Dutch/*
(?i)!/Dutch
(?i)!/Deutsch/*.pdf
(?i)/Deutsch/*
(?i)!/Deutsch
(?i)!/Other/*.pdf
(?i)/Other/*
(?i)!/Other
(?i)!*.pdf
*

@cosas Unfortunately @brunod is right, that is a limitation of the current matching: Lets take e.g. a/b.pdf, then * matches the directory a, so it is skipped and a/b.pdf is never checked at all (in which case it would be included by !(?i)**.pdf).

Then you are lucky :slight_smile:

I’m more as I have the same kind of tree you have with nested sub-dirs [PicturesRoot]/YYYY/YYYYMM blahblah in a 1st computer that I fully sync with a 2nd computer.

My own day2day laptop is also involved in this share, but nearly all the time I have a single * enabled as I don’t need to waste space in my SSD. Sometimes although, I need to sync a single whole subfolder YYYY/YYYYMM blahblah what I do by inserting the same syntax you show above on top of my single * (once done the job requiring this and sync back done, I just comment the lines with // for syntax memory purpose).

To check your issue I added a single !(i)*mG0075.jpg on top : ST then created in my laptop just the needed tree to the 7 files it found in the 2 other devices.

Notice all my nodes are set R/W for this shared folder which eventually make a difference in this matter with you… maybe.

Good luck

[EDIT] @imsodin

He said “exclude all but any *.pdf anywhere”. Why not just use !*.pdf. This single * doesnot match the / so no subdir will be excluded out from parsing ? As shown above this works for me… strange.

I’d also try !(?i)**/*.pdf (but maybe not very usefull), not forgiving the final * all at bottom

The double asterisk “**” is indeed unnecessary, but the point about skipping dirs still applies. To not ignore /a/b.pdf but everything else you need

!*.pdf
!/a
*

Something like /c/b.pdf will still be ignored though.

If you don’t mind syncing all directories, you should be able to go for this:

!*.pdf
!*/
*

:alien: ?

Before:

(?i)(?d)*.ini
(?i)(?d)*.lnk
(?i)(?d)*Thumbs*.db
//!2013/201305 Portugal/24
//2013/*
//!2013
!2017/201712 30-31**
2017/*
!2017
!17
*

me@lap:~/Sync/Photos$ ls -ld *
drwxrwxr-x 2 me me  4096 avril 26  2017 0 ! DON'T DEL BELOW (pour éviter les bétises)
drwxrwxr-x 2 me me  4096 déc.  23 09:51 0 scripts
drwxrwxr-x 2 me me  4096 juin  23  2017 0 supprimer incrustations
drwxrwxr-x 6 me me 69632 janv.  8 16:09 17
drwxr-xr-x 3 me me  4096 janv.  8 15:06 2017
me@lap:~/Sync/Photos$ find -iname "*mg0075.jpg"    
me@lap:~/Sync/Photos$

After:

!(?i)*mg0075.jpg
(?i)(?d)*.ini
(?i)(?d)*.lnk
(?i)(?d)*Thumbs*.db
//!2013/201305 Portugal/24
//2013/*
//!2013
!2017/201712 30-31**
2017/*
!2017
!17
*

me@lap:~/Sync/Photos$ ls -ld *
drwxrwxr-x 2 me me  4096 avril 26  2017 0 ! DON'T DEL BELOW (pour éviter les bétises)
drwxrwxr-x 2 me me  4096 déc.  23 09:51 0 scripts
drwxrwxr-x 2 me me  4096 juin  23  2017 0 supprimer incrustations
drwxrwxr-x 6 me me 69632 janv.  8 16:09 17
drwxr-xr-x 3 me me  4096 janv. 22 12:03 1996
drwxr-xr-x 5 me me  4096 janv. 22 12:03 1998
drwxr-xr-x 4 me me  4096 janv. 22 12:03 1999
drwxr-xr-x 3 me me  4096 janv. 22 12:03 2001
drwxr-xr-x 3 me me  4096 janv.  8 15:06 2017

me@lap:~/Sync/Photos$ find -iname "*mg0075.jpg"
./1999/199904 Les filles en Espagne/IMG0075.jpg
./1999/199908 Parcay/IMG0075.jpg
./2001/200102 Fanny & Théo/IMG0075.jpg
./1996/199608 Océan/IMG0075.jpg
./1998/199807 Maubuisson/IMG0075.jpg
./1998/199807 Les filles à Oléron/IMG0075.jpg
./1998/199811 ESC Grenade & Contis/IMG0075.jpg
me@lap:~/Sync/Photos$

@imsodin to show nothing else was sync’ed (works as hoped):

ls -R ./199[0-9]/*
./1996/199608 Océan:
IMG0075.jpg

./1998/199807 Les filles à Oléron:
IMG0075.jpg

./1998/199807 Maubuisson:
IMG0075.jpg

./1998/199811 ESC Grenade & Contis:
IMG0075.jpg

./1999/199904 Les filles en Espagne:
IMG0075.jpg

./1999/199908 Parcay:
IMG0075.jpg
me@lap:~/Sync/Photos$ ls -R ./2001/*
./2001/200102 Fanny & Théo:
IMG0075.jpg
me@lap:~/Sync/Photos$

I create a new share with this structure :

ls --group-directories-first -R -C
.:
Nouveau dossier  Nouveau fichiervideLvl0.pdf  Nouveau fichiervideLvl0.txt

./Nouveau dossier:
Nouveau fichiervideLvl1.pdf  Nouveau fichiervideLvl1.txt

So reality is 2 levels, 4 files, 1 pdf at each level.

The .stignore contents what you wrote :

!*.pdf
!*/
*

The share says there is 1 file and 0 directory instead of 2 pdf and 1 folder.

@cosas The problem I describe only applies to scanning, i.e. if you create your something matching *mg0075.jpg it wont be added to the index and thus not synced to anywhere else. For pulling, there is no parent directory to traverse and it is thus not skipped. That may actually be fixable (the scanning side of course), I’ll keep that in mind for after the current scanner shuffle.

@brunod Unfortunately my idea is trash, as */ only matches contents of a directory, not directories themselves. So it really looks like that you need to explicitly include every directory you want (at least for the time being).

1 Like

Anyway, even at present state, I prefer this because I really know what I share instead of trying to exclude a perpetual growing file list of extensions, that will change on various hardware and OS, so having a common .stignore in the cluster would be useless and even dangerous. Thanks ! :slight_smile:

Noneless, I still have my original problem with inconsistent global state counter… Is there something possible to do with it ?

Ooops. Sorry, it appears I completely missed the important part in the case (although I nearly pointed it to BrunoD stating the R/W vs RO status, but I should have pointed this to myself and insist :frowning: ): IIUC, he tries to discriminate what the RO (server) will advertise (for clarity, let’s call this what you call “scanning”, in fact scan-then-advertise), when I talked about filtering at ~client~ side amongst say a server that would show whatever it knows depending on its own some-ignores/no-ignores-at-all (whether or not some-ignores/no-ignore-at-all are the same on each side).

OK, in my example, my ~server~ hasn’t any ignores (but cosmetic (?i)(?d).ini/.lnk/Thumbs.db) and I just “pull” a tiny subset, only requiring a single line pattern + “*” like in my *mg0075.jpg example, or a cascaded syntax like the one BrunoD shows when I need a whole sub-dir… and even, in this last case, after you clarified, maybe a single line would do the job:

!full/path/to/   (or some tweak as replace/complete trailing "/" with "**" or "*"  
* 

I’ll give a try later next time I’ll need.

Good day all STers

And one more question : this display perturbs me, but does it mean any trouble/risk for the synchro system, or is it just a human feedback that syncthing doesn’t need to work ?

Still no idea what might be the cause. I believe it is no immediate reason for it to cause troubles, but as I don’t understand the cause, I can’t be sure. You could try running syncthing once with STCHECKDBEVERY=0 environment variable set and see whether that resolve the problem.

Thanks, I’m running syncthing from app center on a Qnap nas; I don’t know how to pass parameter on this device… :confused: Is it possible through the “restart” menu ? Or any other handy way ? If I stop it to restart through ssh, I’m not sure it will run exactly as it should…

I don’t know Qnap. Do you know where the config is located and which user Qnap runs Syncthing as? If yes, you can just once run syncthing manually from the command line as that user, with -home option pointing to the config location and setting STCHECKDBEVERY=0 env var.

1 Like

Sorry, I’ve tried, but I’m lost in the scripts of scripts to start, delay and so on any qnap app “easy” packaged… I’ll digg later if ever I can. Thanks anyway.

I think I’ve found. Let’s have 2 directories, spread over the cluster; configure .stignore to limit access to one of them; rescan. The ignored folder will be removed from local, but it will stay on global and can’t be removed. If you remove it from the master, as it is not scanned according .stignore, it’s removal isn’t propagated. Maybe parameter (?d) in .stignore could help/solve, but I haven’t used it 'till now. Thanks ! BD

1 Like