Ubuntu – How to find files between two dates using “find”

command linefind

I have an email account that has passed 60GB of emails, and currently I'm having a lot of trouble using an email client to archive emails of last year (2011).

Via terminal, I am trying to use find to locate the files between 2011-01-01 and 2011-12-31, but no avail.

How can I find files between two dates?

If relevant, the end goal will be a batch that will move each file found, matching the date interval, to a folder.

Best Answer

You can use this script:

#!/bin/bash
for i in $(find Your_Mail_Dir/ -newermt "2011-01-01" ! -newermt "2011-12-31"); do
  mv $i /moved_emails_dir/
done