Linux – How to restrict find command search to return only files modified before certain date

findlinux

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

Best Answer

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