Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .