Operating System - HP-UX
1820267 Members
2800 Online
109622 Solutions
New Discussion юеВ

Re: find files modified on a certain date

 
SOLVED
Go to solution
yyghp
Super Advisor

find files modified on a certain date

I need to search the whole filesystem for all those files being modified/accessed on Jan 26,2006.
How can I use "find" command to do that?
Thanks!
3 REPLIES 3
Pete Randall
Outstanding Contributor

Re: find files modified on a certain date

Use the touch command to create two files, one dated 23:59 on Jan 25 and one date 00:01 on Jan 27. Then you can use find's - newer option (and it's antithesys ! -newer) to zero in on just the files you want. See the man pages for touch and find.


Pete

Pete
Steven E. Protter
Exalted Contributor

Re: find files modified on a certain date

Shalom,

I'd suggest the following:

make a file called /tmp/timestamp

put in it 200601260000

find /fsname -newer /tmp/timestamp > list1
Change the date in /tmp/timestamp to 200601270000

find /fsname -newer /tmp/timestamp > list2

compare the two files with diff command.

You may be able to make this work with the +mtime parameter

+mtime

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
James R. Ferguson
Acclaimed Contributor
Solution

Re: find files modified on a certain date

Hi:

Create two reference files and search for files that were modified/accessed between the time boundries of the reference files:

# touch -amt 200601260000 /tmp/ref1
# touch -amt 200601262359 /tmp/ref2

# find /path -xdev -type f -newermm /tmp/ref1 -a ! -newermm /tmp/ref2

...finds candidates based on *mtime*.

# find /path -xdev -type f -neweraa /tmp/ref1 -a ! -neweraa /tmp/ref2

...finds candidates based on *atime*.

If you want to search every filesystsem, drop the '-xdev' argument that confines you to your mountpoint and do:

# find / - type f ...

See the manpages for 'find' for more information.

Regards!

...JRF...