Using bash to find a file modified in a specific date/time interval?
Did you ever need to find a file stored somewhere in a bunch of folders, which you didn’t remember the name, but you remember about when you last modified the file? At work, it sometimes happens that I need to find some log file, among 20 Gigs of log files, which was modified on a certain day. Here is a simple bash trick to do just that:
touch -d "13 october 2006 15:00:00" ~/date_start touch -d "14 october 2006 21:00:00" ~/date_end find some/path -newer ~/date_start -and -not -newer ~/date_end
Val Dodge
Good tip. If you have GNU date, you can do it without creating files:
find some/path -newermt "13 october 2006 15:00:00" -and -not -newermt "14 october 2006 21:00:00"