'find' utility does not output all files when using wildcards

Running:

$find . -name *.exe

gives:

./MakeItSo_1.2.2/MakeItSo_1.2.2/MakeItSo.exe
./MakeItSo.exe

but those are not the only exe files in the directory. For example, running

$find . -name ATLTester.exe

gives:

./Debug/ATLDmoVexaTester.exe

Solution 1:

It's because of shell globbing. Try:

find . -name "*.exe"

When not quoted, *.exe expands to all *.exe files in the current directory, unless there are none. It so happens you have just one such a file there, so your original command was in fact:

find . -name MakeItSo.exe

If you had no *.exe files in the current directory then shell globbing wouldn't occur, find would get *.exe argument literally and your command would work as you expected. On the other hand if you had more than one file with this extension, they all would be given as arguments to find and this would lead to syntax error.