cancel
Showing results for 
Search instead for 
Did you mean: 

find command

SOLVED
Go to solution
Sagar Sirdesai
Trusted Contributor

find command

Hi
I am trying to find files in /var which have modified in the last 3 days . Here I want to exclude /var/opt/ignite directory
I used the below command

find /var -path /var/opt/ignite -prune -mtime -3 -print.
But this command does not work
Please advise.

Sagar
4 REPLIES
Peter Nikitka
Honored Contributor
Solution

Re: find command

Hi Sagar,
use
find /var -path /var/opt/ignite -prune -o -mtime -3 -print

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Sagar Sirdesai
Trusted Contributor

Re: find command

Thanks Peter it worked.
But not sure why -o option need to used as it does OR peration

Sagar
Hakki Aydin Ucar
Honored Contributor

Re: find command

Hi,
# find /var/opt/ignite -mtime -3 -print
Peter Nikitka
Honored Contributor

Re: find command

Hi Sagar,

seeing multiple predicates, find connects them via AND by default. Now if you analyze your request carefully, you'll recognize that 'find' has to check for every entry found

- is it located in /var/opt/ignite
- is the modification date below the 3 days limit

Now '-prune' acts like a stop condition, and for every entry found you want to have the STOP condition OR check for more valid predicates.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"