It is a feature of the
TraversalMode.MatchFilesShallow. Imagine these two scenarios:
1) You call
The method searches the
"C:\Temp" directory for every "
*.txt" file. If no such file is found, the method doesn't throw an exception, which I think is expected behavior.
2) You call
This is special case of the call above. You don't want to search for all "
*.txt" files, but for the "TempFile.txt" only. The method doesn't distinguish between these two scenarios, so no exception is thrown, which can be confusing.
To get an exception when the source file doesn't exist, please use the