Force Include Filter

Discuss new features and functions
Posts: 14
Joined: 18 Feb 2016

FlowXP

Hello all,
Let me show you my current filter setup :
Include Filter:
*
General knowledge\*
General knowledge\*.mkv

Exclude Filter:
*.iso
*.zip
*.mkv
I want to "force" the inclusion of mkv files that are located in the folder "General knowledge".
I googled but I couldn't find any solution, is there anyway I can do this ?
User avatar
Posts: 3876
Joined: 11 Jun 2019

xCSxXenon

Remove '*.mkv' from your exclusion filter
The existence of 'General knowledge\*.mkv' in the inclusion filter means no MKV files outside that folder will be synced
User avatar
Posts: 2388
Joined: 22 Aug 2012

Plerry

The first rule of your Include Filter is *.
Therefore everything is included, except for items that are explicitly Excluded per the Exclude Filter rules. The next two rules of your Include Filter are therefore obsolete.
And, as xCSxXenon wrote, your Exclude rule *.mkv should be removed, otherwise all mkv-files will be excluded.

But, given your posting, I suspect that by writing
I want to "force" the inclusion of mkv files that are located in the folder "General knowledge"
you mean you want to exclude all mkv-files from your sync, except for the mkv files in the folder "General knowledge".
If so, that is a case as described in "Example: Complex filter rules with exceptions" in the Manual page on Filtering
You then need to use two folders pairs and local filter settings:
C:\Source <—> D:\Target local exclude filter: \General knowledge\ and *.mkv
C:\Source <—> D:\Target local include filter: \General knowledge\ (instead of *)
OR two folder pairs:
C:\Source <—> D:\Target local exclude filter: \General knowledge\ and *.mkv
C:\Source\General knowledge\ <—> D:\Target\General knowledge\ (empty local exclude filter)
OR two folder pairs:
C:\Source <—> D:\Target local exclude filter: *.mkv
C:\Source\General knowledge\ <—> D:\Target\General knowledge\ local include filter: *.mkv

Use the icons in between each left-right pair to define local Compare, Sync and/or Filter settings.
User avatar
Posts: 3876
Joined: 11 Jun 2019

xCSxXenon

The first rule of your Include Filter is *.
Therefore everything is included, except for items that are explicitly Excluded per the Exclude Filter rules. The next two rules of your Include Filter are therefore obsolete. Plerry, 12 Jun 2024, 17:07
I wasn't so sure of this myself, so I didn't mention it. I was pretty sure an item has to match all inclusion filters to be considered, but that is incorrect. An item can match any inclusion line to be included, barring exclusions
Posts: 14
Joined: 18 Feb 2016

FlowXP

Thank you for the answers so far, but let me rephrase a little to be more clear.
I have a bunch of folders to sync and they all have huge mkv files.
But of all, only from "General knowledge" I'm interested in saving EVERYTHING there, including mkv files
I was hoping that this would work like in other programs, with the "!" operator :
INCLUDE:
*

EXCLUDE:
*.mrimg
*.mkv
*.iso
!General knowledge\*.mkv
User avatar
Posts: 3876
Joined: 11 Jun 2019

xCSxXenon

Reset to default filters, change include from '*' to '*\General Knowledge\'
User avatar
Posts: 2388
Joined: 22 Aug 2012

Plerry

> I was hoping that this would work like in other programs, with the "!" operator

Unfortunately for you, that's not how the FFS filter rules work.
From the FFS Manual page on filtering:
Files and folders are only considered for synchronization if they pass all filter rules: They have to match at least one entry in the include list and none of the entries in the exclude list as presented in the filter configuration dialog.
> I have a bunch of folders to sync and they all have huge mkv files.
> But of all, only from "General knowledge" I'm interested in saving EVERYTHING there, including mkv files

So, my suspicion was correct.
Therefore you have to use two left-right folder pairs, as described in my previous reply.
Posts: 14
Joined: 18 Feb 2016

FlowXP

The first rule of your Include Filter is *.
Therefore everything is included, except for items that are explicitly Excluded per the Exclude Filter rules. The next two rules of your Include Filter are therefore obsolete. Plerry, 12 Jun 2024, 17:07
I wasn't so sure of this myself, so I didn't mention it. I was pretty sure an item has to match all inclusion filters to be considered, but that is incorrect. An item can match any inclusion line to be included, barring exclusions xCSxXenon, 12 Jun 2024, 18:03
Include : "*" - well that's the default ...
But thank you for your time,
So there is no way to include only some mkv files with the current settings in Freefilesync.
Maybe in the future ... or a future request.
Posts: 14
Joined: 18 Feb 2016

FlowXP

I will have to make a separate session/sync just for that folder alone
User avatar
Posts: 2388
Joined: 22 Aug 2012

Plerry

> So there is no way to include only some mkv files with the current settings in Freefilesync.

That depends on what you mean by "the current settings".
Not with your current settings.

But, repeating myself, you can certainly use FFS to achieve your sync goal:
Just use any of the two left-right pair combinations described in my first reply
with the settings as described there.
Posts: 14
Joined: 18 Feb 2016

FlowXP

The first rule of your Include Filter is *.
Therefore everything is included, except for items that are explicitly Excluded per the Exclude Filter rules. The next two rules of your Include Filter are therefore obsolete.
And, as xCSxXenon wrote, your Exclude rule *.mkv should be removed, otherwise all mkv-files will be excluded.

But, given your posting, I suspect that by writing
I want to "force" the inclusion of mkv files that are located in the folder "General knowledge"
you mean you want to exclude all mkv-files from your sync, except for the mkv files in the folder "General knowledge".
If so, that is a case as described in "Example: Complex filter rules with exceptions" in the Manual page on Filtering
You then need to use two folders pairs and local filter settings:
C:\Source <—> D:\Target local exclude filter: \General knowledge\ and *.mkv
C:\Source <—> D:\Target local include filter: \General knowledge\ (instead of *)
OR two folder pairs:
C:\Source <—> D:\Target local exclude filter: \General knowledge\ and *.mkv
C:\Source\General knowledge\ <—> D:\Target\General knowledge\ (empty local exclude filter)
OR two folder pairs:
C:\Source <—> D:\Target local exclude filter: *.mkv
C:\Source\General knowledge\ <—> D:\Target\General knowledge\ local include filter: *.mkv

Use the icons in between each left-right pair to define local Compare, Sync and/or Filter settings. Plerry, 12 Jun 2024, 17:07
YES !!! you were right !!, I'm sorry I didn't pay more attention to this, I was on the road ...
I already tried something like this with batch sessions, but they don't work if the filters are in conflict.
And I never tried it like this with multiple folders in the same session...never knew you can have different filters and they are treated separately so there is no conflict.
Now IT DOES WHAT I WANT !!
So thank you all for the responses and @Plerry, apologies for not reading more carefully