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 -- you're running into the shell's wildcard expansion, so what you're acually passing to find will look like.

Up vote 2 down vote favorite 1 share g+ share fb share tw.

I am having a hard time getting find to look for matches in the current directory as well as its subdirectories. When I run find *test. C it only gives me the matches in the current directory.

(does not look in subdirectories) If I try find . -name *test. C I would expect the same results, but instead it gives me only matches that are in a subdirectory.

When there are files that should match in the working directory, it gives me: find: paths must precede expression: mytest. C What does this error mean, and how can I get the matches from both the current directory and its subdirectories? Linux bash script find link|improve this question asked Jun 27 '11 at 15:51chris1056 100% accept rate.

Try putting it in quotes -- you're running into the shell's wildcard expansion, so what you're 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.

1 for the single quotes remark. – Spencer Rathbun Jun 27 '11 at 16:00 Great, thank you! I appreciate the clear explanation- this also helps solve similar problems I have encountered... – chris Jun 27 '11 at 16:28 By way of example, you can see what's happening if you do echo *test.

C ... the result won't be echo expanding the wildcard, but the shell itself. The simple lesson is if you're using wildcards, quote the filespec :-) – Chris J Jun 27 '11 at 17:21.

What's happening is that the shell is expanding "*test. C" into a list of files. Try escaping the asterisk as: find .

-name \*test.c.

Try putting it in quotes: find . -name '*test.c.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions