Link to home
Create AccountLog in
Avatar of virgo0880
virgo0880

asked on

AIX find command

Hi All,

How do I exclude directories using the AIX 5.3 find command. -path option not working, I want to exclude all of my nfs systems, all my oracle filesystems. How to achieve that.

Thanks
virgo
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of virgo0880
virgo0880

ASKER

Ok, I have GNU find install on one of the box but I am not getting the exact syntax of excluding the directories like oracle* , nfs filesystems, whats the syntax for that.

Virgo
Just remembered that it's always a good idea to exclude /proc!

df -P | egrep -v "^/proc|Filesystem" | egrep -v "oracle" |awk '{print $NF}' | xargs -I{} find {} ! -fstype nfs -xdev -name "*xxx*"
This will exclude the filesystem which I want, I also want to exclude certain directories which is not to be searched, in that case what would be the syntax.

Thanks
Virgo
when i am executing that command, it is throwing error saying :

xargs: 0402-051 Specify a positive integer after the -l option.

do we need to specify some number with xargs ?

virgo
With GNU find you have the "-path" option, but GNU's "-fstype" doesn't work very well in AIX.
You can try it: "! -fstype nfs" but I didn't have much success with that test.

find / ! -path "*oracle*" ! -path "*nfs_path1*" ! -path "*nfs_path2*" -name "*xxx*"

nfs_path1, nfs_path2 are examples of NFS paths to be excluded.

wmp
That's the uppercase letter "I" as in "IBM", not the lowercase "l"!
Maybe this:

find / \( -name "*oracle*" -prune \) -o \( -fstype "nfs" -prune \) -o -name "*xxx*" -print

wmp