For reference i am still a newb at scripting, but i have what i think is a complex issue.
I need to run a FIND on / to identify all files and print them to >> $TEMPFILE
I need to avoid MVFS
I need to avoid /var/tmp/nastmp/
I was trying find / \( -type d -name nastmp -prune \) -a \( -fstype mvfs \) -print
But this is not working at all. I can get them to work separately but i need both conditions to be met.
Can someone point me in the right direction?
Hi, nitrobass24:
You want to use a boolean OR instead of AND. Use two -o
operators between the three expressions (keeping the -print last).
Regards and welcome to the forum,
Alister
Ahh i see.
Ok so i have
find / \( -type d -name nastmp -prune \) -o \( -fstype mvfs \) -o -print
But I am getting directories printed to the file instead of files only. Is there a way for me to specify that only files get written to log?
nitrobass24:
Ahh i see.
Ok so i have
find / \( -type d -name nastmp -prune \) -o \( -fstype mvfs \) -o -print
But I am getting directories printed to the file instead of files only. Is there a way for me to specify that only files get written to log?
Actually, that will descend into an mvfs filesystem (for some reason, I thought there was another -prune in the mvfs expression). What you want is something like the following (untested):
find / -type d \( -name nastmp -o -fstype mvfs \) -prune -o -type f -print
Regards,
Alister
1 Like
Thanks to Allister, this is working great!
Just wanted to post my final code, hopefully it will help someone else in the future.
if [[ $OS = "HP-UX" ]]
then
$FIND / -type d \( -name nastmp -o -name centrify* \) -prune -o -type f -print >> $TEMPFILE
else
$FIND / -type d \( -name nastmp -o -name centrify* -o -fstype mvfs \) -prune -o -type f -print >> $TEMPFILE
1 Like