Different filters for folders and files (* and *.*)

Discuss new features and functions
Posts: 2
Joined: 10 Mar 2021

TakeCareBruh

idk what to put here after that title so I'll just explain why .-.

I'm trying to sync all files in a directory but exclude all subdirectories EXCEPT SOME
but that doesn't work since to exclude all subdirectories except some you normally only put the ones you want to include and remove the * filter but that doesn't include files

then what about putting \*\ in the exclude filter and * in the include filter? well yeah except now the included subdirectories actually end up being excluded...

So uh... that's pretty much it

EDIT: well after I thought about it for a bit... since folders already have their \*\ notation it would be best to just leave * for everything and introduce a new *.* for files
User avatar
Posts: 2451
Joined: 22 Aug 2012

Plerry

> ... you normally only put the ones you want to include and remove the * filter but that doesn't include files
If this approach fits your use case, do not Include e.g.
\FolderA\
\FolderB\
but instead Include
\FolderA\*
\FolderB\*
This will not just include the folders, but also all of the folder content.

The alternative is as (crudely) described in the FFS manual section on Excluding Items: use multiple left-right base folder pairs.
Suppose e.g. you want to sync all of C:\Folder1\Folder11\ to D:\Backup\, but want to exclude all subfolders of C:\Folder1\Folder11\Folder111\, except for C:\Folder1\Folder11\Folder111\FolderA and C:\Folder1\Folder11\Folder111\FolderB.
• Define a first left-right pair:
Left1: C:\Folder1\Folder11\
Right1: D:\Backup\
and use the standard (global) Include filter *
and add \Folder111\*\ or \Folder111\*\* to your (global) Exclude Filter
• And define a second left-right pair:
Left2: C:\Folder1\Folder11\Folder111\FolderA\
Right2: D:\Backup\Folder111\FolderA\
• And define a third left-right pair:
Left3: C:\Folder1\Folder11\Folder111\FolderB\
Right3: D:\Backup\Folder111\FolderB\
Assuming neither FolderA nor FolderB has a direct subfolder named Folder111, this should work OK.

If necessary/desired, you can even overcome the listed limitation by using local Include/Exclude Filter settings (via the funnel-icon in between each folder pair), e.g:
• Define a first left-right pair:
Left1: C:\Folder1\Folder11\
Right1: D:\Backup\
use the standard global Include and Exclude Filter settings
and use a standard local Include filter *
and add \Folder111\*\ or \Folder111\*\* to your local Exclude Filter
• And define a second left-right pair:
Left2: C:\Folder1\Folder11\Folder111\
Right2: D:\Backup\Folder111\
and use a local Include Filter
\FolderA\*
\FolderB\*
and the standard local Exclude Filter
Posts: 2
Joined: 10 Mar 2021

TakeCareBruh

my case is different than your example since the files I want to include are the files directly under the folder in the left-right pair e.g. syncing folder 1 to folder 2 I want to include the files directly inside folder 1 but exclude all folders (and their content) except say 2 folders namely folder 1\folder a\ and folder 1\folder b\

the issue can be easily solved by defining 2 sync pairs of the same left-right pair (folder 1 to folder 2)
and using the two approaches I described in the post in the local filters of the pair

e.g.
first pair - folder 1 to folder 2:
include:
*
exclude:
\*\

second pair - folder 1 to folder 2:
include:
\folder a\
\folder b\

exclude: empty

the first pair will update the files and the second pair the 2 folders I wanted to include but the issue is this requires more than one sync pair... having a files filter instead of using "everything except folders" filter would remove the need for this hacky solution