I want to exclude any temporary MS Office file (also from subfolders).
I don't need to distinguish from file or folder.
Suppose the temporary file always begin with "~$".
I tested the following patterns:
~$* -> works only for files from root folder.
\~$* -> same as above.
*\~$* -> works for files from root and any subfolder.This is what I need.
I it true? Specially, "~$*" and "\~$*" are the same?
Cheers
Simple doubt on exclude filter
- Posts: 7
- Joined: 19 Dec 2023
-
- Posts: 2607
- Joined: 22 Aug 2012
Include and Exclude Filter rules are always relative to the left and right base location.
I believe that for that reason Zenju, the author of FFS, made the initial backslash "\" superfluous (but still allowed).
The fact that the initial backslash is still allowed makes it possible to define rules like your 3rd rule.
Because the initial wildcard "*" matches any arbitrary number of characters, including none, for the base directories your 3rd rule is identical to your 2nd rule.
(I have been excluding temporary MS Office files in this way for more than 10 years. See e.g. here.)
I believe that for that reason Zenju, the author of FFS, made the initial backslash "\" superfluous (but still allowed).
The fact that the initial backslash is still allowed makes it possible to define rules like your 3rd rule.
Because the initial wildcard "*" matches any arbitrary number of characters, including none, for the base directories your 3rd rule is identical to your 2nd rule.
(I have been excluding temporary MS Office files in this way for more than 10 years. See e.g. here.)
- Posts: 7
- Joined: 19 Dec 2023
Now I found all the causes of my confusion:
1. "*" matches ANY character and this includes de folder separator.
2. The filter applies to the complete relative path.
Bang! I was not paying enough attention to the rules.
Thank you!
1. "*" matches ANY character and this includes de folder separator.
2. The filter applies to the complete relative path.
Bang! I was not paying enough attention to the rules.
Thank you!
-
- Posts: 2607
- Joined: 22 Aug 2012
@Zenju
I think I am pretty proficient regarding FFS's filter rules.
However, triggered by the above thread I am partially back to my 2019 confusion.
In your reply to my confusion you state
I understand "child elements directly below the base folders" as being "files in the base folders themselves". Please correct me if I am wrong.
If *\ matches all folders, but not the files directly in the base folders and not the base folders themselves, how can *\~$* also be matching files directly in the base folders starting with "~$" ?
Does just *\ have a different meaning than the *\ in e.g. *\~$* ?
I really like to understand, and once I [finally ... ;-) ] do, may be able to (even?) better assist forum members.
I think I am pretty proficient regarding FFS's filter rules.
However, triggered by the above thread I am partially back to my 2019 confusion.
In your reply to my confusion you state
(The underlining in the quote is mine).So then we have *\ as a match for all folders, and with the previous rule, also all child elements. What is NOT matched however are child elements directly below the base folders. Base folders are just containers and have no representation in FFS that would be considered during filtering, so they are never matched.
I understand "child elements directly below the base folders" as being "files in the base folders themselves". Please correct me if I am wrong.
If *\ matches all folders, but not the files directly in the base folders and not the base folders themselves, how can *\~$* also be matching files directly in the base folders starting with "~$" ?
Does just *\ have a different meaning than the *\ in e.g. *\~$* ?
I really like to understand, and once I [finally ... ;-) ] do, may be able to (even?) better assist forum members.
-
- Site Admin
- Posts: 7348
- Joined: 9 Dec 2007
"child elements" means files, folders, or symlinks.
This rule does not apply to path separator in the middle like *\~$*:
* means zero or more characters, therefore this phrase defines a superset of \~$*, which is equivalent to ~$*.
A path separator at the end like *\ has the special meaning to match folders only, just like *: has the special meaning to only match files, as documented: https://freefilesync.org/manual.php?topic=exclude-filesIf *\ matches all folders, but not the files directly in the base folders and not the base folders themselves, how can *\~$* also be matching files directly in the base folders starting with "~$" ?
Does just *\ have a different meaning than the *\ in e.g. *\~$* ? Plerry, 14 Mar 2025, 14:06
This rule does not apply to path separator in the middle like *\~$*:
* means zero or more characters, therefore this phrase defines a superset of \~$*, which is equivalent to ~$*.
-
- Posts: 2607
- Joined: 22 Aug 2012
@Zenju
Sorry for being so persistent, but now it seems there is a contradiction.
.
So, I need to understand that "child elements directly below the base folders" means "files, folders and symlinks in the base folders themselves" alias "files, folders and symlinks in the root of the base folders", not just the files in the root of the base folders.
When I combine that with the last part of
The contradiction rests in that (fortunately ...) this is not what FFS is actually doing.
When using the special meaning filter rule *\ , FFS actually matches all (sub)folders of the base folders, thereby also matching folders directly in the root of the base folders.
Sorry for being so persistent, but now it seems there is a contradiction.
.
I knew that as a general definition, but can/could not place that in the context as used."child elements" means files, folders, or symlinks
So, I need to understand that "child elements directly below the base folders" means "files, folders and symlinks in the base folders themselves" alias "files, folders and symlinks in the root of the base folders", not just the files in the root of the base folders.
When I combine that with the last part of
this would imply that also folders (not just files) in the root of the base locations are NOT matched.So then we have *\ as a match for all folders, and with the previous rule, also all child elements. What is NOT matched however are child elements directly below the base folders.
The contradiction rests in that (fortunately ...) this is not what FFS is actually doing.
When using the special meaning filter rule *\ , FFS actually matches all (sub)folders of the base folders, thereby also matching folders directly in the root of the base folders.
-
- Site Admin
- Posts: 7348
- Joined: 9 Dec 2007
You're right, Plerry, in the quote you're citing I should have said "files/symlinks" instead of "child elements". I've edited the comment accordingly.
-
- Posts: 2607
- Joined: 22 Aug 2012
Thanks!
It only (...) took me 6 years to fully get it ... ;-)
It only (...) took me 6 years to fully get it ... ;-)