find: Prevent .git folders from printing to STDOUT

Posted by Nathan Neff on Stack Overflow See other posts from Stack Overflow or by Nathan Neff
Published on 2010-05-13T05:00:01Z Indexed on 2010/05/13 5:04 UTC
Read the original article Hit count: 261

Filed under:

Hello, I have a find command that I run, to find files named 'foo' in a directory.

I want to skip the ".git" directory.

The command below works, EXCEPT, it prints an annoying ".git" any time it skips a .git directory

find . ( -name .git ) -prune -o -name 'foo'

How can I prevent the skipped ".git" directories from printing to STDOUT?

Thanks,

--Nate

© Stack Overflow or respective owner

Related posts about find