find command and excluding a directory during the search
I have a network share drive mounted as /netshare1
I would like to perform this search and exclude the /netshare1 directory from the search: find / -type b -o -type c > /temp/device-file-list any ideas??? Robert |
Give this a try:
Code:
find / -path /netshare1 -prune -o -type b -o -type c |
Code:
! -path '/netshare1/*' |
worked perfect. tks.
I was messing around with the prune command and just didn't have it in the right order. find / -path '/netshare1/*' -prune -o -type b -o -type c > /temp/test Robert |
Quote:
|
Thanks! finally got a simple find to work...
Quote:
Your code was the first that was not so complicated, I was able to hack and adapt it to do what I want. Code:
# find / -path /home -prune -o -name "cron*" still don't know why i need -o (or) and not 'and' if i want it to do both things, exclude directory /home AND 'find' "cron*"... but it works. Thanks ! Landis. |
@Lunar: I'm not sure if the find command used is what you want or does what you expect it to do....
The above command will print /home (but not any content): Code:
# find / -path /home -prune -o -name ".bash*" 1 - Look for /home but don't print any content (-path /home -prune) -> this prints /home OR 2 - find files/dirs/etc that start with .bash If you want to completely exclude directories from the search you could use something like this: Code:
# find / ! \( -name home -prune \) -name ".bash*" |
Quote:
Code:
( -path /home -and -prune ) -or ( -name '*.bash*' -and -print ) |
Thank You.
Quote:
Thank you.. I've never gotten the find / ! \ ( ..... stuff to work before, but then i've always attributed the 'file not found' type errors to my using openSuSE... but bash is bash, more or less, right.. So, I very carefully duplicated your example with my search, INCLUDING spaces (which i mostly thought i could ignore, like blah blah | more or ..blah|more, same difference ) and valah, it works and it's much quicker... I thought it printed /home to let me know it was 'empty' (skipped).. lol Thanks !!! Landis. |
Thank You.
Quote:
Thank you, very much for taking the time to explain the 'why'... Landis. |
Quote:
Quote:
Quote:
Quote:
|
Quote:
|
All times are GMT -5. The time now is 03:14 PM. |