Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

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
share|improve this answer
add comment

Your Answer

 
discard

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.