![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Find command uisng -prune or -only | 2reperry | UNIX for Advanced & Expert Users | 7 | 02-22-2008 03:55 PM |
| find command with prune help | venu_nbk | UNIX for Dummies Questions & Answers | 2 | 05-28-2007 06:25 AM |
| Find command with prune and exec options | Sebarry | UNIX for Dummies Questions & Answers | 2 | 06-19-2006 04:07 AM |
| Find command with prune and exec | Sebarry | UNIX for Advanced & Expert Users | 1 | 06-18-2006 01:43 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
I am trying to get a list of top level directories below the search path but I don't want to descend subdirectories. The find command listed below returns me the list I want but it also returns subdirectories. I can't seem to get the -prune option to work the way I want. How would I modify the following find command?
find ../users -type d \( -name "e[0-9]*" -o -name "users/cnt[0-9]*" \) ../users/cnt4071 ../users/e5034071 ../users/e0905759 ../users/home.archive/e0279813 <-- I don't want to see this one |
|
||||
|
That was cool!
As always Perderabo's answers are a real treat!!
BTW I found this site which contains info related to the trick Perderabo had just done... http://www.uni-ulm.de/~s_smasch/various/find/ great explanation... Cheers! Vishnu. |
|
||||
|
find ../users \( ! -name users -prune \) -name 'e[0-9]*' -o -name 'cnt[0-9]*'
../users -> search in /users. \( ! -name users -prune \) -> list directories in the level of /users/thislevel. -name 'e[0-9]*' -> list the single directory level which matches the search criteria -0 -> the or syntax... -name 'cnt[0-90*' -> also if matches this..... is the above understanding correct? |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|