I do not understand "*:"

Get help for specific problems
Posts: 3
Joined: 20 Feb 2023

Arlingtoner

Given a directory structure on my Windows system:

...\temp\file1.txt
...\temp\file2.txt
...\temp\aaa
...\temp\bbb
...\temp\ccc
...\temp\ddd

with files in all four subdirectories, I want to synchronize all the files in temp and a subset of temp's subdirectories and files with another directory, say temp2. I couldn't figure out a way to do that with one configuration. What includes and excludes should I have used?

I did manage to do it with two configurations, one to sync the subset of temp's subdirectories and their files and one to sync just the files in temp.

For the desired subdirectories:

Include:
\aaa\
\bbb\
Exclude: nothing

For temp's files:

Include:
\*: or \*
Exclude:
\*\

What is the point of "*:" in the above? "*:" seems to work the same as "*".

When I was trying to do everything in one configuration, I hoped that the following would work:

Include:
\*: (the syntax for a single file with the "all files (but not folders)" symbol)
\aaa\
\bbb\
Exclude: nothing

But I ended up with all the files and subdirectories (I presume that the ccc and ddd subdirectories were created by implication of their files needing someplace to be put). I can make the above work by excluding \ccc\ and \ddd\, but in the real world my temp directory contains many more directories I want excluded than I want to type in individually.

So, if "*:" creates directories/folders, what does it really mean? In what circumstances would I use it effectively?

Oh, one more thing. If my include looks only like "\*:\" and there are no excludes, then there are "No files to synchronize." Why? It seems like my include is nonsense, verging on a syntax error, so I kind of expected some sort of rebuke and a refusal to do a comparison.
User avatar
Posts: 4867
Joined: 11 Jun 2019

xCSxXenon

https://freefilesync.org/manual.php?topic=exclude-files
"*:" matches all files but not folders
Posts: 3
Joined: 20 Feb 2023

Arlingtoner

Yes, I've read that manual page a few times, but, in my mind, it doesn't quite work that way in practice. For example, in a couple of spots in my original post, "*" and "*:" produced the same results (I presume because of implicit subdirectory creation). While my mystification may be just a case of newbie denseness, I would greatly appreciate an example or two of "*:" being used where only its unique matching accomplishes the objective.
User avatar
Site Admin
Posts: 7506
Joined: 9 Dec 2007

Zenju

Quoting from the manual:
Example: Exclude empty folders

Set *: as include filter to match all files, but not folders. During synchronization some excluded folders will still be created if needed, but only if they contain at least one non-excluded item, that is, when they are not empty.
Posts: 3
Joined: 20 Feb 2023

Arlingtoner

Is there a way to restrict "all the files" to just the base directory level other than the exclude \*\ that I used in my original post? I thought that \*: might do that, as the manual says the filter for a single file is \file.txt, but clearly things don't work that way.

Is there a way to have one configuration sync only the files in the base directory and specified subdirectories? If not, then I "understand" *: well enough for practical purposes as my original post stated that I can accomplish my goal in two configurations.