Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|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

2 Answers 2

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
share|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

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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