Saturday, April 27, 2024
24
rated 0 times [  24] [ 0]  / answers: 1 / hits: 143991  / 2 Years ago, thu, july 14, 2022, 10:47:39

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.


More From » command-line

 Answers
6

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

[#35423] Friday, July 15, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
taigysel

Total Points: 33
Total Questions: 136
Total Answers: 114

Location: Singapore
Member since Wed, Jan 13, 2021
3 Years ago
;