1834276 Members
2430 Online
110066 Solutions
New Discussion

Re: find command

 
SOLVED
Go to solution
Gemini_2
Regular Advisor

find command

I would like to run a find command that display 2005 logs directory.

I tried "find . -type d -mtime -30", but it display the logs from "today" to 30 days ago....

how do I display the log that is older than 30 days..

thank you
4 REPLIES 4
Steven E. Protter
Exalted Contributor

Re: find command

Shalom,

Try type f.

Any time a directory has any file updated in it, it may get its time and date stamp updated.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ivan Ferreira
Honored Contributor
Solution

Re: find command

Very simple, just change -30 to +30, the argument is like this:

-30 From now to 30 days ago
+30 Since 30 days or more
30 Exaclty 30 days
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Gemini_2
Regular Advisor

Re: find command

yes, I used "30" and that doesnt work...+ is perfect..thank you

Muthukumar_5
Honored Contributor

Re: find command

Older than 30 days,

You have to use +30 so that it will search 31 or older days. -30 means it will search before 30 days.

So use as,

# find . -type d -mtime +30

will give that. To remove those directory then,

# find . -type d -mtime +30 -exec rm -irf {} \;

will do.

--
Muthu
Easy to suggest when don't know about the problem!