linux – find: paths must precede expression: How do I specify a recursive search that also finds files in the current directory?

linux – find: paths must precede expression: How do I specify a recursive search that also finds files in the current directory?

Try putting it in quotes — youre running into the shells wildcard expansion, so what youre acually passing to find will look like:

find . -name bobtest.c cattest.c snowtest.c

…causing the syntax error. So try this instead:

find . -name *test.c

Note the single quotes around your file expression — these will stop the shell (bash) expanding your wildcards.

Whats happening is that the shell is expanding *test.c into a list of files. Try escaping the asterisk as:

find . -name *test.c

linux – find: paths must precede expression: How do I specify a recursive search that also finds files in the current directory?

Try putting it in quotes:

find . -name *test.c

Leave a Reply

Your email address will not be published.