"find" command: How to exclude a directory name?

"find" command: How to exclude a directory name?

Post by kk_.. » Mon, 13 Feb 2006 11:17:06



Hi.  How would I use the find command to return a list of all files
(just files--not directories) of the pattern "*.cpp" that are not in a
directory called "UNIT_TEST"?

Thanks!

Ken

 
 
 

"find" command: How to exclude a directory name?

Post by Xichen » Mon, 13 Feb 2006 11:38:48


try this:

find -type d -name UNIT_TEST -prune -o -name "*.cpp" -type f -print

Xicheng


> Hi.  How would I use the find command to return a list of all files
> (just files--not directories) of the pattern "*.cpp" that are not in a
> directory called "UNIT_TEST"?

> Thanks!

> Ken


 
 
 

1. How to exclude multiple directories from "Find"

Hi all,

I am using ksh on AIX 5.2, "Find" does not support "-path"

I searched previous posts and got some hints,
If I want to exclude only /tmp, the following command is working well
find /!(tmp) -user foobar -print

How about to exclude /tmp, /proc, and /dev all together?
Is there a similiar way to do it?

Many thanks,

James

2. Newbie: pstree, slocate, mingetty, makewhatis and gawk

3. GETSERVBYNAME()????????????????????"""""""""""""

4. Linus-wannabe? Make a POSIX Real Time OS!!

5. named: "found it", ping: "unknown host"

6. ppp-on

7. "find" and "locate" commands not working, linux RH5.2

8. Using RTLD_LAZY (dynamic loading)

9. How to track "Inode", "name" and "buffer" cache rates

10. "write" "to" "flon" commands

11. "weof" operation in "mt" command gives "permission denied"

12. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""