Exclude syntax help (sub-subdirectories)

Get help for specific problems
Posts: 4
Joined: 29 Aug 2019

Whiplash

What is the syntax for excluding sub-subdirectories?

What I'm really trying to do is just copy a top level folder structure. The folder structure is a bunch of dated backup directories, which are huge. I want to create the new target structure so that I can break up the sync into multiple jobs. (If I tried to do this in one go it will definitely fail at some point, so I want to babysit it a chunk at a time.)

So I have:
TopFolder
-backupdate1
--stuffIdon'twantyet1
--stuffIdon'twantyet2
-backupdate2
--stuffIdon'twantyet1
--stuffIdon'twantyet2
-backupdate3
--stuffIdon'twantyet1
--stuffIdon'twantyet2

And I want to just pull:
TopFolder
-backupdate1
-backupdate2
-backupdate3

I can also see a scenario where I only want data to a certain level, like doing a sweep of old system backups where I know anything I created is only going to be n levels deep (probably 5) and anything deeper than that is system or application stuff. It would be a lazy way to prune relevant stuff from old backups without having to manually look at folder structures. A simple way to reclaim HD space for backups that are so old they will never be used to restore a system.

I've googled articles for about 30 minutes now, and tried every variation I can think of with no luck. Any help would be appreciated!
User avatar
Posts: 2946
Joined: 22 Aug 2012

Plerry

The manual-page on excluding items already shows how to exclude all sub-dirs of the left and right base folders. This requires an Exclude filter of *\ (for Windows) or */ (for Mac or Linux).
Similarly, if you want to exclude everything that is at least two folder levels deep (as per your example), you should be able to use an Exclude filter of *\*\ (or */*/ for Mac or Linux)).
Posts: 4
Joined: 29 Aug 2019

Whiplash

Yeah, that's what you'd think. It returns "nothing to synchronize". If I go a level deeper I get the folders and the files. Tried Mirror, tried Update, tried multiple drives & test directories to make sure it didn't have something to do with the disk image/sparsebundle source I was using. When I go deeper I get the next level of folders and files. (So instead of just 20 or 30 folders it pulls 110k files plus the folders.)

Can you exclude all files & filetypes with a *.* ? I tried that and it didn't seem to work the way I expected.

I got it to work with this:
/*/*/*/

and added a 1 byte file size limit. Hokey, but it worked. If you can point out what I'm missing and explain how to do it the "right" way, I'd appreciate it.
User avatar
Posts: 2946
Joined: 22 Aug 2012

Plerry

It would have helped if you would have indicated how you have defined your left and right base folder pair.
Based on what you had success with, it seems you have defined your left and right base folders as the parents of Topfolder at either side, and not as Topfolder (at either side) itself.
Posts: 4
Joined: 29 Aug 2019

Whiplash

What, for gods sake, is a base folder pair and why do I need to know what that is to synchronize directories?

"Based on what you had success with, it seems you have defined your left and right base folders as the parents of Topfolder at either side, and not as Topfolder (at either side) itself."

I've read this sentence several times now and I still haven't a clue what you are trying to convey. I'm assuming that base folders are some sort of special entity? Which ones are the base folders and why are they special?
Posts: 4
Joined: 29 Aug 2019

Whiplash

And... Is this your software or are you just a kindly soul?
User avatar
Posts: 2946
Joined: 22 Aug 2012

Plerry

What, for gods sake, is a base folder pair and why do I need to know what that is to synchronize directories?
Well, apparently you (still) did not bother to read the manual pages or view the instruction videos.
So, don't expect me (kindly soul or not) to spend any more time on this topic.
Posts: 1
Joined: 8 Jul 2023

John666

Hi, new to this app.
\*\ will stop subfolders from being included.

LeoW

Two options I found that both seem to work:
I checked the docs, and then I asked Bard, CHATGPT and that's where I found the second one. Not claiming to understand why they are both exactly the same functions I just know that they both do the same exact thing.
*\
**\*

Patterns get complicated quickly, not just here. Syncthing exclude filters are based on shell programming techniques making it very difficult.