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
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
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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*"
df -P | egrep -v "^/proc|Filesystem" | egrep -v "oracle" |awk '{print $NF}' | xargs -I{} find {} ! -fstype nfs -xdev -name "*xxx*"
ASKER
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
Thanks
Virgo
ASKER
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
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
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
find / \( -name "*oracle*" -prune \) -o \( -fstype "nfs" -prune \) -o -name "*xxx*" -print
wmp
ASKER
Virgo