1825789 Members
2135 Online
109687 Solutions
New Discussion

Files searching

 
SOLVED
Go to solution
sudhapage
Regular Advisor

Files searching

Hi

I want to search what are the files modified or created on particular period. Like Sep-10-06 to Setp-15-06. Give me some examples.

Regards,
Sudhakaran.K
7 REPLIES 7
Yang Qin_1
Honored Contributor
Solution

Re: Files searching

Hi, Sudhakaran,

Try:

find . -type f -mtime -20 -a -type f -mtime +5 -exec ll {} \;

Regards,
Yang
Joel Girot
Trusted Contributor

Re: Files searching

Hi,

Build two files with touch : first for begin date second for end date and find with newer option :

touch -t 200609100000 filestart
touch -t 200609150000 filestop
find / -type f -newer filestart -a ! -newer filestop -exec ls -l {} \;

Regards,
Joel
Jaime Bolanos Rojas.
Honored Contributor

Re: Files searching

Sudhapage,

Also there are some other examples on this thread:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1048222

Regards,

Jaime.
Work hard when the need comes out.
sudhapage
Regular Advisor

Re: Files searching

Hi Yang,

What output I will get If I execute this one?

Can u explain this command?

Regards,
Sudhakaran.K
Ivan Krastev
Honored Contributor

Re: Files searching

The output from this find is long listing (exec ll) of files (-type f) modified since 20 days ago (mtime -20) and 15 days (mtime +5).

For more useful examples see man find.

regards,
ivan
Yang Qin_1
Honored Contributor

Re: Files searching

Hi,

It will find the files created/modified newer than 20 days and older than 5 days.

Today is 29 Sep the commands will find files created before 23 Sep and after 9 Sep

Regards,
Yang
Arturo Galbiati
Esteemed Contributor

Re: Files searching

Hi,
I agree with Joel's solution, but with a little enhancement:
instead of:
find / -type f -newer filestart -a ! -newer filestop -exec ls -l {} \;

use:
find / -type f -newer filestart -a ! -newer filestop |xargs -i ll {}

this is quicker than previous and uses less system resources. -exec create every time a new process.

HTH,
Art