Include folders and exclude some of their subfolders

Get help for specific problems
Posts: 29
Joined: 11 Dec 2022

franksisco

Hi, I'm having trouble creating the right include/exclude filter.

Let's say I'm mirror synchronizing the contents of folder A into folder B. Inside A there is a lot of stuff and I want to define with the filters what to include or exclude. Let's say I put in the "include" filter the folders
/Folder05/
/Folder25/
/Folder31/

But inside "Folder31" I want everything except a subfolder named "Subfolder26"

How do I indicate this exclusion within an inclusion?
User avatar
Posts: 3606
Joined: 11 Jun 2019

xCSxXenon

Add "/Folder31/Subfolder26/" to the exclude filter
Posts: 29
Joined: 11 Dec 2022

franksisco

Sorry I completely got the question wrong. I tried to summarize my case with a completely wrong example. I'll do it again.

Mirror synchronization between folder A and folder B. I want all files and folders in A to be included but with one important exception. In A/subfolder11/ I have a lots of files and folders but I want, only in this case, to only include A/subfolder11/subsubfolder21/ content

So I can't enter
/subfolder11/subfolder21/ in "Include" because I should then insert hundreds of other paths. And I can't enter all things to exclude from /subfolder11/ a part from subsubfolder21 because even in this case that's too many items to list

Therefore, as a neophyte, I was hoping it could be solved by using the right language. I don't know for example by entering in "Exclude" something that sounds like "anything in subfolder11 except subsubfolder21"
User avatar
Posts: 2287
Joined: 22 Aug 2012

Plerry

You should follow the "Example: Complex filter rules with exceptions" section of the FFS manual page on Exclude Files.
For your 1st pair use local exclude filter: /subfolder11/
For your 2nd pair use local include filter: /subfolder11/subfolder21/
Posts: 29
Joined: 11 Dec 2022

franksisco

First of all, thank you for your help. Let's focus on the last case. That's the one I'm interested in.

If I just put /subfolder11/subsubfolder21/ in the local include filter, I certainly include "subsubfolder21" and exclude all the rest of "subfolder11" content, which is ok but it's just a minimal part of what I was asking about. As mentioned I also need to include all the rest of the A/subfolders and content. This is the problem.

In A I have a situation similar to this:
(!!!The names I am putting here are examples. The actual folders do not have names with sequential numbers that can help in defining them!!!)

A/subfolder01/..... (All content to be included)
A/subfolder02/..... (All content to be included)
A/subfolder03/..... (All content to be included)
A/subfolder04/..... (All content to be included)
A/subfolder05/..... (All content to be included)
A/subfolder06/..... (All content to be included)
A/subfolder07/..... (All content to be included)
A/subfolder08/..... (All content to be included)
A/subfolder09/..... (All content to be included)
A/subfolder10/..... (All content to be included)
A/subfolder11/.....(All other subfolders and files except subsubfolder21 and its contents should be excluded)
A/subfolder12/..... (All content to be included)
A/subfolder13/..... (All content to be included)
A/subfolder14/..... (All content to be included)
A/subfolder15/..... (All content to be included)
A/subfolder16/..... (All content to be included)
and so on, including every subfolder and their content until the last A/subfolder300/..... (All content to be included)

So I need to find a way to indicate to include hundreds of A subfolders, too many to manually "include", of which I need to keep everything except for the A/subfolder11/ of which I need to exclude everything except A/subfolder11/subfolder21/ and its contents.

Therefore.

- If I don't use filters, it's no good, because the rest of the subfolders and files in A/subfolder11/ also enter the synchronization.
- If I put A/subfolder11/subsubfolder21/ in n "include" it is no good because all other subfolders of A besides subfolder11 are not considered
- I can't put in "exclude" all other subfolders and files in A/subfolder11/ apart from subsubfolder21 which I don't want because there are too many to list

This is the reason why I am asking if it is possible to solve the problem with computer language, simply by creating a mirror synchronization of everything in A !!except!! for subfolder11 case of which everything except its subfolder subsubfolder21 has to be excluded

I really don't know how to explain it any better than that.
User avatar
Posts: 2287
Joined: 22 Aug 2012

Plerry

The answer I previously gave is exactly the solution to your problem (as I already understood it from your 2nd post but you repeated above).
The 1st pair and added local Exclude Filter rule /subfolder11/ will sync all folders but subfolder11 and its content.
The 2nd pair and local Include Filter rule /subfolder11/subsubfolder21/ (replacing the default *) will sync only subfolder11/subsubfolder21 and its content.
Posts: 29
Joined: 11 Dec 2022

franksisco

Sorry, because of my poor English I thought your "first pair" was referring to my first example. I hadn't really thought about using two different couplers for the same directory.
I was looking for the right syntax or formula to do it with just one but that is perfectly fine, thank you