Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


LinkBack Search this Thread
Old 08-25-2006, 03:33 PM   #1
Registered: Aug 2006
Distribution: slack
Posts: 323

Rep: Reputation: 30
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

Old 08-25-2006, 04:07 PM   #2
Registered: Dec 2005
Location: New York
Distribution: Debian/GNU
Posts: 235

Rep: Reputation: 30
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:

find / \( -name /dev -prune -o -name /proc -prune -o -name /sys -prune  \) -o \( -cmin -20 -a -print \)
The parentheses might not be needed, but I think they are.

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.

Last edited by dombrowsky; 08-25-2006 at 04:09 PM.
Old 08-25-2006, 04:19 PM   #3
Registered: Aug 2006
Distribution: slack
Posts: 323

Original Poster
Rep: Reputation: 30
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 \)

Last edited by ygloo; 08-25-2006 at 04:34 PM.
Old 08-25-2006, 04:44 PM   #4
Registered: Aug 2006
Distribution: slack
Posts: 323

Original Poster
Rep: Reputation: 30
used what you told me in a script to find files changed or modified :

Uptime=$( less /proc/uptime | awk '{ print $1 }')
UpMinutes=$( echo $(( $UpSeconds / 60 )) )

Sort ()
awk '{ print $3, $5, $6, $8, $9, $10, "\t " $11 }'

echo i - $UpMinutes mins since boot
echoc "skipping dev,proc and sys directories" green

echo "how far to look back ??"


echoc "_______________________________________ created:" green
find / \( -path /dev -prune -o -path /proc -prune -o -path /sys -prune \) -o \( -cmin -"$REPLY" -type f -ls \) | Sort

echoc "_______________________________________ modified:" green
find / \( -path /dev -prune -o -path /proc -prune -o -path /sys -prune \) -o \( -mmin -"$REPLY" -type f -ls \) | Sort
} > list

Last edited by ygloo; 09-03-2006 at 05:09 PM.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
linux find to find files with multiple patterns subu_s Programming 6 12-15-2010 12:15 AM
Find command - multiple file types mrclisdue Linux - General 4 07-03-2006 03:48 AM
using multiple -exec commands in a single find command? Bluemilk Linux - Newbie 4 03-19-2006 10:46 AM
Find excluding multiple directories with a wildcard pteigeler Linux - Software 1 09-02-2005 10:57 AM
find and copy files into multiple directories avargas22 Linux - Newbie 2 04-01-2004 11:11 AM

All times are GMT -5. The time now is 10:50 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration