Operating System - HP-UX
1829745 Members
1213 Online
109992 Solutions
New Discussion

How to find a file by time stamp

 
SOLVED
Go to solution
Joseph Bague
Frequent Advisor

How to find a file by time stamp

Hi to all,

How to find a file by time stamp. e.i. I want to find a file with a time stamp between Oct 27 9:30 PM and Oct 28 06:30 am.

Thanks in advance :)
Joseph
Expect nothing but ready for everything
2 REPLIES 2
Stefan Farrelly
Honored Contributor
Solution

Re: How to find a file by time stamp

Between times isnt easy. I know of no command to do it in one go. I would try something like;

ll -R | grep -e "Oct 28 01:" -e "Oct 28 02:" -e "Oct 28 03:" -e "Oct 28 04:" -e "Oct 28 05:" -e "Oct 28 06:"

To find files from Oct 28 01-06am, a similar command for Oct 27 9:30pm to midnight.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Graham Cameron_1
Honored Contributor

Re: How to find a file by time stamp

The easiest way I can think is to create 2 files, with tbe begin and end time stamps, then use find.

Something like:

touch -t 200310272130 earliest
touch -t 200310280630 latest
find . -type f -newer earliest ! -newer latest -exec ls -ld {} \;

see "man touch", man "find"

-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.