using find - need to exclude a directory
I want to find all occurrences of a particular file on a Linux machine but I don't want to search a particular folder tree (it's huge and I know the file isn't there - I'm looking for float.h files)
I can do:
and it works but it takes a very long time.
find / -name "float.h"
I could use:
and this works except that I know the machines being used for this don't have an up-to-date database for locate (don't ask ...) so this won't work.
locate float.h | grep \/float.h$
What I think I need to use is -prune in the find command but I can't work out how to do it.
looks like it's working but it isn't because if I do
find / -name float.h -prune -o -path '/home'
so that it throws away all the errors then I can see it's listing files in the /home tree.
find / -name float.h -prune -o -path '/home' 2> /dev/nul
In case anyone's wondering, this is a teaching exercise - the students have been told to find all the C compilers on the Linux VMs. I know the answer (I put them there!) but they've been told that each compiler will have a set of header files including float.h. What appears to a bug in VMWare Player means that if they scan the entire filesystem (including several directories which are actually NFS mounts) the VM grinds to a halt and takes out the Windows network stack on the host machine!