I'm looking for a command which lists all files created between 4 and 7:40 o'clock this morning. I'm aware of find . -mtime 0 but that lists all files created today. I can pipe it to a grep but than my knowledge fails me on how to filter out all files but the files created between 4 and 7:40.

link|improve this question

A bunch of file systems don't actually have a creation timestamp, including ext3 (ext4 has it). Are you really looking for modification timestamps? – l0b0 Mar 18 '11 at 9:19
feedback

2 Answers

up vote 2 down vote accepted

If you have GNU find, you can do this:

find -newermt "2011-03-17 04:00" ! -newermt "2011-03-17 07:40"

With other versions of find, you can do something like this:

touch -d "2011-03-17 04:00" start
touch -d "2011-03-17 07:40" end
find -newer start ! -newer end
rm start end
link|improve this answer
our unix versions uses -t instead of -d, and date version is slightly different: touch -t "201103170740" end. Apart from that this worked beautiful! Oh and today is 18 mar in our timezone. Produced some unexpected results :-) – dr jerry Mar 18 '11 at 10:03
feedback

The -mmin option of find uses minutes instead of days.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.