find command - multiple direcories
how to ignore three dirs at once:
/dev /proc /sys how to add 2 more here?? find / -cmin -20 -path '/proc' -prune -o -print :scratch: |
I always have to try three or four times in order to get all the find options to work correctly, but here's my first guess:
Code:
find / \( -name /dev -prune -o -name /proc -prune -o -name /sys -prune \) -o \( -cmin -20 -a -print \) BTW, the default operation between find(1) commands is "and" (-a). This means that there is an implied "-a" between "-name foo" and "-prune". Find(1) can be quite annoying. Read the man page and do plenty of test cases. |
i get confused how to mix the options...
changed "-name" with "-path" ...and it works! find / \( -path /dev -prune -o -path /proc -prune -o -path /sys -prune \) -o \( -cmin -20 -a -print \) |
used what you told me in a script to find files changed or modified :
#!/bin/bash Uptime=$( less /proc/uptime | awk '{ print $1 }') UpSeconds=${Uptime%.*} UpMinutes=$( echo $(( $UpSeconds / 60 )) ) Sort () { awk '{ print $3, $5, $6, $8, $9, $10, "\t " $11 }' } echo echo i - $UpMinutes mins since boot echoc "skipping dev,proc and sys directories" green echo echo "how far to look back ??" read { echo echoc "_______________________________________ created:" green find / \( -path /dev -prune -o -path /proc -prune -o -path /sys -prune \) -o \( -cmin -"$REPLY" -type f -ls \) | Sort echo echoc "_______________________________________ modified:" green find / \( -path /dev -prune -o -path /proc -prune -o -path /sys -prune \) -o \( -mmin -"$REPLY" -type f -ls \) | Sort echo } > list |
All times are GMT -5. The time now is 10:21 PM. |