This will search in /data/in
and find files (-type f
) with the name ending in .tar.gz
which are older (-not -newer
) then the timestamp on the file /tmp/end
:
touch --date "2011-09-03" /tmp/end # Specify a specific date from 3+ years ago
find /data/in -type f -name "*.tar.gz" -not -newer /tmp/end
You can also use the flags -mtime N
to search for files older then the last N days, but sometimes it's easier to simply specify a date instead of calculating the number of days over 3 and some-odd days.
Inspiration from http://www.cyberciti.biz/faq/linux-unix-osxfind-files-by-date/
find
command can easily do what you suggest. Just read its man page.