Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-03-2006, 11:27 PM   #1
LQ Newbie
Registered: Jan 2006
Location: Australia
Distribution: Fedora Core 4 and Cygwin
Posts: 14

Rep: Reputation: 0
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?

find * -wholename 'dirname' -prune -o -print
Old 06-03-2006, 11:50 PM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
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 ).


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Where to find the source of gnu/linux shell utilities irfanhab Programming 1 03-16-2006 06:05 AM
Prune Portage tree beaucoup Linux - Software 3 02-05-2005 04:03 PM
How to prune a print & file server to leave minimal services running wolfpeach Linux - Security 4 06-29-2004 06:35 AM
Need help with some commands to prune files... smeenge Linux - Software 2 05-21-2004 05:10 PM
How do I prune logs manually? Jonah W Linux - Newbie 1 08-29-2001 04:21 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:26 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration