find glob expansion
When using regular expression in find, you have to quote the name parameter to prevent glob expansion (the name expansion done by the shell)
find . -name *.java
vs
find . name "*.java"
The first method will expand to the files you have at the current directory, so say if you have a file named "hello.java", then the command you wrote will be expanded into find . -name hello.java
which will only find "hello.java".
The second method when you quote the pattern, you prevent it from being expanded in the shell, and will correctly find all of the files that have .java extension.
No Comments