Server Fault is a question and answer site for system and network administrators. 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'd like to constrain the following search to only files with a modified date <= "2009-05-29 11:59:00"

find /path -name "*.sb" ! -name "*[^0-9]*.sb"  -type f -print

I'm using CentOS

share|improve this question
up vote 4 down vote accepted

The command find /path -mtime +7 will give you files older than 7 days, and find ! -newer somefile will give you files older than somefile. So...

touch -d "2009-05-29 11:59:00" timestampfile

find /path -name "*.sb" ! -name "*[^0-9]*.sb" ! -newer timestampfile -type f -print
share|improve this answer
or simply -mtime -1 ;) – Alex J May 30 '09 at 17:01
Just out of curiosity, why would anyone mark down this answer as not helpful? – Matt Simmons May 30 '09 at 17:42
The '-newermt "DATE"' is a simpler/more elegeant way if you have GNU findutils installed. This is a little more portable across various UNIX versions, though it depends on the capabilities of your touch command. – pgs May 31 '09 at 2:41
To be clear: find /foo/bar/ -type f -newermt "$(date='7 days ago')" – Stéphane Jan 22 '13 at 7:38

! -newermt '5/29/2009 23:59:00' should work on BSD; there will be a similar option on GNU.

share|improve this answer
Its the same switch in GNU. – Kyle Brandt May 30 '09 at 17:19
yep! this one is great! work on GNU/Linux as such: find . -type f -newermt '9/13/2012 18:09:00' – woohoo Jan 5 '13 at 23:12
find /path \
  -type f \
  ! -newermt "20090529 1159:00" \
  -regex "./[^0-9]*.sb$" \

You can place the regex at the end to speed up the command (place the fastest actions at the start, slowest at the end).

share|improve this answer

You want -mdate

find /path -name ".sb" ! -name "[^0-9]*.sb" -type f -print -mdate -2009-05-30

Here are a couple of examples:

share|improve this answer

Your Answer


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.