LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to prune more than one directory using GNU find (https://www.linuxquestions.org/questions/programming-9/how-to-prune-more-than-one-directory-using-gnu-find-451381/)

judgex 06-03-2006 11:27 PM

How to prune more than one directory using GNU find
 
I know how to prune one directory with find. How do I prune two or more directories?

Code:

find * -wholename 'dirname' -prune -o -print

jschiwal 06-03-2006 11:50 PM

find / \( -wholename "/media/*" -o -wholename "/usr/*" -o -wholename "/opt/*" -o -wholename "/etc/*" -o -wholename "/home/*" -o -wholename "/lib/*" -o -wholename "/SuSEdvd*" -o -wholename "/lib64*" -o -wholename "/proc/*" -o -wholename "/sbin/*" \) -prune -o -print

The results are pruned, but the directories are still transversed. If you don't have permissions for a directory of file in one of the pruned patterns, an error message is printed (via stderr ).


All times are GMT -5. The time now is 03:05 AM.