Take the 2-minute tour ×

I am trying to find all my GRAPHML files under the current directory in bash. So I ran the following command:

find . -name *.graphml

And I get the error message:

find: paths must precede expression

What is wrong with the command above? The strange thing is that it works fine for other regexps.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Always enclose the pattern in quotes (e.g. *.graphml in your case). Otherwise it will be expanded by the shell before the find command. This means that find does not get a literal *graphml passed, but rather what the shell expands *.graphml to.


find . -name "*.graphml*"


  • man find which says: "Don't forget to enclose the pattern in quotes in order to protect it from expansion by the shell."
  • A little more about Quoting from the Advanced Bash Scripting Guide.
share|improve this answer
add comment

Your Answer


