Question: non-recursive find syntax

Hello, I am trying to search a directory for all files matching "G*" without looking in sub-directories "success" and "error". I've searched this forum and found the following syntax, but can't make it work:

find . \( ! -name success -prune -name error -prune \) -type f -name "G*"

Have consulted the man pages for find, experimenting with -depth but no luck. Please let me know what I'm doing wrong.

Thanks,
alexkav

find . \( -name success -prune \) -o \( -name error -prune \) -o -name "G*" -print

Perfect. Thank you!

Hello agian, is it possible to adjust the "find" command to only find files beginning with "G" and followed by numbers?

For example:

good: G102030
bad: GFI_UPLOAD.log

Thanks,
alexkav

Ok, here's using grep:

find . \( -name success -prune \) -o \( -name error -prune \) -o -name "G*" -print) | grep '[0-9]\{6\}'

Thanks,
alexkav

what if there are a lot of subdirectories, or there are subdirectories under subdirectories(like a tree), that is, I shouldn't be specifying what subdirectories not to descend. Isn't there a way to tell find command to search for file only in the specified directory(but do not descend any subdirectory) ?

Look in the faq section for the answer.