Operating System - HP-UX
1844208 Members
2002 Online
110229 Solutions
New Discussion

How to use "find" command?

 
SOLVED
Go to solution
lin.chen
Frequent Advisor

How to use "find" command?

Dear all,
I want to find some files which has been modified during the last 30 days?
How can use the command?

Regards,Louis
4 REPLIES 4
Tim Nelson
Honored Contributor

Re: How to use "find" command?

man find

find /path -mtime -30

Pete Randall
Outstanding Contributor

Re: How to use "find" command?

find /start_dir -type f -mtime +30


Pete

Pete
James R. Ferguson
Acclaimed Contributor
Solution

Re: How to use "find" command?

Hi Louis:

# find /path -xdev -type f -mitme -30

...will list the files (not directories) that have been modified *within* the last 30-days.

If you want files older than 30-days since modification, change the '-30' to +30'.

Regards!

...JRF...

mobidyc
Trusted Contributor

Re: How to use "find" command?

Hello,

find /dir -mtime 29

substract /dir with the path where you want to search.

you can pass argument to the result of your search by:
find /dir -mtime 29 -exec ls -l {} \;

ls -l <= is the command to launch
{} <= is the result of your search, element by element
\; <= is the terminating arument for find

man find fr additionnals informations

--
Regards,
Cedrick Gaillard
Best regards, Cedrick Gaillard