Greedy - non-greedy matches or differentiation between full path-filename only

Discuss new features and functions
Posts: 4
Joined: 27 Jun 2022

d05register

Could you implement a non-greedy matching? I want to copy 01* files e.g only the 1st in this example

\foo\01 myFolder\01 myFile.txt
\foo\01 myFolder\other File.txt

If I include *\01* it matches the folder also so it copies all the files
If I add an exclude *\01*\ to exclude the folder only it matches again all, and copies nothing

A solution (I think) would be a non-greedy modifier (as in Perl is the "?" ) https://perldoc.perl.org/perlre
or something like this https://docs.syncthing.net/users/ignoring.html where an Asterisk (*) matches
any character but not the folder separator while Double asterisk (**) mathces any character including folder separators

Thanks
Posts: 1239
Joined: 8 May 2006

therube

Is \01*\01* viable?
Posts: 4
Joined: 27 Jun 2022

d05register

No. In include list it misses my main goal the 01* files e.g. case 3

1. \foo\01 myFolder\01 myFile.txt
2. \foo\01 myFolder\other File.txt
3. \foo\other Folder\01 myFile.txt

In exclude list I would need something like \01*\?!01* i.e. exclude only case 2 (01 folder\not 01 file)
User avatar
Site Admin
Posts: 7537
Joined: 9 Dec 2007

Zenju

Possible with FreeFileSync 11.24! viewtopic.php?t=9475#p34605

By appending ':' to the include filter, it will match files only:
*\01*:
Posts: 4
Joined: 27 Jun 2022

d05register

Man it doesn't work (just updated to 14.9 from 13.9 to be sure).
Found some files in conflict because of the workarounds I use to overcome this case

Tried a new clean test case. I want to mirror all files starting with 01
I use *\01*:
No matter what, it selects also folders starting with 01SomeFolder\ with all its files which is Wrong

Please fix
Posts: 4935
Joined: 11 Jun 2019

xCSxXenon

Well, technically your filter is including all files whose path starts at the root of the base location and starts with "01". The ending asterisk is a wildcard that catches everything, even subfolders, in each file's path. I don't know the solution at this moment, but that at least explains the behavior.
Posts: 4
Joined: 27 Jun 2022

d05register

Yes but this is wrong

Even if you use *\01*.pdf:
i.e. two indicators that you want to match files only, one is the :, and the other is the .pdf
it again mathces whole paths e.g. 01SomeFolder\SomeFile.pdf

So if you have folder prefixes common to file prefixes you are FUBAR. You can't match only the files
This ruins an otherwise so good software, it's a pity
User avatar
Posts: 2997
Joined: 22 Aug 2012

Plerry

If all files with a name starting with 01 have the same folder depth to your left and right base location, you should still be able to do it.
As per your example:
1. \foo\01 myFolder\01 myFile.txt
2. \foo\01 myFolder\other File.txt
3. \foo\other Folder\01 myFile.txt

If foo is the direct child of your base location, you should be able to
Include \foo\*\01*: or even *\*\01*: and
Exclude \foo\*\*\* or even *\*\*\*

If foo is your base location, you should be able to
Include *\01* and
Exclude *\*\*