LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 08-25-2006, 04:33 PM   #1
ygloo
Member
 
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, 05:07 PM   #2
dombrowsky
Member
 
Registered: Dec 2005
Location: New York
Distribution: Debian/GNU
Posts: 235

Rep: Reputation: 31
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 \)
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 05:09 PM.
 
Old 08-25-2006, 05:19 PM   #3
ygloo
Member
 
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 05:34 PM.
 
Old 08-25-2006, 05:44 PM   #4
ygloo
Member
 
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 :
#!/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

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


Reply

Tags
find


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


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


All times are GMT -5. The time now is 03:47 PM.

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