1834499 Members
2573 Online
110068 Solutions
New Discussion

Re: find

 
Leonid Mishkind
Frequent Advisor

find

Hello to all.
Does anyone knows of a way to make the find command not to descend to dirs under the path?
9 REPLIES 9
Yogeeraj_1
Honored Contributor

Re: find

hi,

Normally, the find command recursively searches the directory tree for each specified Path parameter, seeking files that match a Boolean expression written using the terms given in the following text. When the find command is recursively descending directory structures, it will not descend into directories that are symbolically linked into the current hierarchy.

You can try:

ls -al |grep -i ""


hope this helps!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
RAC_1
Honored Contributor

Re: find

man find. look at -prune and -depth options.

find / ! -depth should work.
There is no substitute to HARDWORK
Pelephone System
Frequent Advisor

Re: find

Thanks for responding . Though none of your suggestions help. ls | grep "find " does not grep the found files , the -depth / prune options still descend to other dirs.
HPUX sysadmin
john korterman
Honored Contributor

Re: find

Hi Mishkind,

try this:

$ find -path "./*" -prune



regards,
John K.
it would be nice if you always got a second chance
Peter Godron
Honored Contributor

Re: find

Hi,
please see answers in :

"Prevent find to go into subdirectories "

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1097204

Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.
Yogeeraj_1
Honored Contributor

Re: find

hi again,

suppose you want to find file "passwd"

SERVER2: >cd /etc/
SERVER2: etc>ll -al|grep "passwd"
-rw-r--r-- 1 root security 750 Jan 27 14:46 passwd
SERVER2: etc>

hope this helps!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Peter Nikitka
Honored Contributor

Re: find

Hi,

I assume you want to skip only some directories, not all. Modify my example, which will find all .xml-Files recursively but skip directories, whose names start with the letter 'e':

find . -name 'e*' -prune -o -name '*.xml' -print

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Pelephone System
Frequent Advisor

Re: find

What I want to do is to fined home dirs ( /users FS ) that do not belong to enyone.
What I eventually did is :
find /users/* -nouser -type d | awk -F/ '{print $3}' | sort -u

Thanks to everyone for responding.
HPUX sysadmin
Arturo Galbiati
Esteemed Contributor

Re: find

Hi,
look at man find option prune

HTH,
Art