Repository: pkolaczk/fclones (language: rust)

Issue:
os error 123 in Windows 10
Running `fclones *` in Windows 10 results in an error (sorry for the error message in Polish ;-)
```
[2020-07-19 16:53:35.267] fclones.exe: error: Failed to stat C:\*: Nazwa pliku, nazwa katalogu lub składnia etykiety woluminu jest niepoprawna. (os error 123)
[2020-07-19 16:53:35.269] fclones.exe:  info: Scanned 0 file entries
[2020-07-19 16:53:35.270] fclones.exe:  info: Found 0 (0 B) files matching selection criteria                           
[2020-07-19 16:53:35.272] fclones.exe:  info: Found 0 (0 B) candidates after grouping by size                           
[2020-07-19 16:53:35.274] fclones.exe:  info: Found 0 (0 B) candidates after pruning hard-links                         
[2020-07-19 16:53:35.277] fclones.exe:  info: Found 0 (0 B) candidates after grouping by prefix                         
[2020-07-19 16:53:35.278] fclones.exe:  info: Found 0 (0 B) candidates after grouping by suffix                         
[2020-07-19 16:53:35.280] fclones.exe:  info: Found 0 (0 B) duplicate files
```

Running `fclones . -R` works properly and also running under WSL works properly.




Discussion / hints:
I'm afraid Windows default shell doesn't expand wildcards. 
https://superuser.com/questions/460598/is-there-any-way-to-get-the-windows-cmd-shell-to-expand-wildcard-paths

You can use a combination of `-R` and `--paths ...` or `--names ...` to perform globbing with the builtin glob/regex support.
Could you fix the documentation and error message? The current error message is quite misleading.

The error message is created from the template: `Failed to stat <path>: <reason>` 
The second part (reason) after the colon comes from the operating system. I can't fix it. 

I can improve only the first part a bit. I guess "stat" is a Unix/Linux only thing.
What about  `Failed to read metadata of <path>: <reason>` ?
I don't think changing wording would help much. I wouldn't have guessed that the program is trying to use '*' as a file name. And even if I realized what the program tried to do, I wouldn't know what to do about it.

You could do something like:
```
if path contains '*':
  log warning 'It looks like your shell does not support expanding wildcards. Try using --paths or --names. See https://git.io/JJCLH for more information.'
```

I like your suggesion, although I can imagine the warning could be also wrong and misleading - there is no reliable way of determining if the given file system accepts * (or any other character) as part of the path. E.g. on Linux * is a perfectly valid character in a path. The tool does not know if the user wanted to treat * as a wildcard, or maybe they wanted a literal *. 

I can also imagine the above code could raise the warning even under shells that do support wildcard expansion.
E.g. this is a valid command under bash:
```fclones -R '*'  ```   (search all contents in the directory named * )



Fix patch:
diff --git a/README.md b/README.md
index f8f05e7..7d9d9b6 100644
--- a/README.md
+++ b/README.md
@@ -38,14 +38,24 @@ It easily outperforms many other popular duplicate finders by a wide margin (see
   - `JSON`     
 
 ## Usage
-Find duplicate files in the current directory, without descending into subdirectories:
+Find duplicate files in the current directory, without descending into subdirectories 
+(in Unix-like shells with globbing support):
 
     fclones * 
 
-Find common files in two directories, without descending into subdirectories:
+Find duplicate files in the current directory, without descending into subdirectories (portable):
+ 
+    fclones . -R --depth 1 
+
+Find common files in two directories, without descending into subdirectories 
+(in Unix-like shells with globbing support):
 
     fclones dir1/* dir2/*  
 
+Find common files in two directories, without descending into subdirectories (portable):
+
+    fclones dir1 dir2 -R --depth 1  
+
 Find duplicate files in the current directory, including subdirectories:
 
     fclones . -R
@@ -85,7 +95,7 @@ Exclude a part of the directory tree from the scan:
     
 ### Preprocessing files
 Use `--transform` option to safely transform files by an external command.
-By default, the transformation happens on a copy of a file, to avoid accidental data loss.
+By default, the transformation happens on a copy of file data, to avoid accidental data loss.
 
 Strip exif before matching duplicate jpg images:
 
@@ -97,18 +107,29 @@ List more options:
     
     fclones -h
 
-### Notes
+### Notes on quoting and path globbing
 * On Unix-like systems, when using globs, one must be very careful to avoid accidental expansion of globs by the shell.
-  In many cases having globs expanded by the shell instead of by `fclones` is not what you want. Therefore you
-  need to quote globs:
+  In many cases having globs expanded by the shell instead of by `fclones` is not what you want. In such cases, you
+  need to quote the globs:
     
       fclones . -R --names '*.jpg'       
        
-* On Windows, in the default terminal, quotes are not removed before passing the arguments to the program,
-  and globs are not expanded, therefore you need to pass globs unquoted:
+* On Windows, the default shell doesn't remove quotes before passing the arguments to the program, 
+  therefore you need to pass globs unquoted:
   
       fclones . -R --names *.jpg
-                    
+      
+* On Windows, the default shell doesn't support path globbing, therefore wildcard characters such as * and ? used 
+  in paths will be passed literally, and they are likely to create invalid paths. For example, the following 
+  command that searches for duplicate files in the current directory in Bash, will likely fail in the default
+  Windows shell:
+  
+      fclones *
+      
+  If you need path globbing, and your shell does not support it, 
+  use a combination of recursive search `-R` with `--depth` limit and 
+  built-in path globbing provided by `--names` or `--paths`.     
+                      
 ## Installation
 
 ### Supported Platforms


Test patch: