Script to delete all mails dated 2011 from the mail accounts. email account: user@example.com
=====================
1) touch --date "2011-06-19" /home/example/mail/example.com/user/cur/start
>>> creating a file with particular date [from that date onwards] that we want to delete
2) touch --date "2011-12-31"/home/example/mail/example.com/user/cur/end
>>> file created with a particular date [upto that date] that we want to delete
3) find . -newer /home/example/mail/example.com/user/cur/start -not -newer /home/example/mail/example.com/user/cur/end -exec mv {} --target-directory=/home/example/mov_mail/ ';'
>>> script will move mails dated from 2011-06-19 to 2011-12-31 to the folder /home/example/mov_mail/
4) deleted the contents in the folder /home/example/mov_mail/
=====================
1) touch --date "2011-06-19" /home/example/mail/example.com/user/cur/start
>>> creating a file with particular date [from that date onwards] that we want to delete
2) touch --date "2011-12-31"/home/example/mail/example.com/user/cur/end
>>> file created with a particular date [upto that date] that we want to delete
3) find . -newer /home/example/mail/example.com/user/cur/start -not -newer /home/example/mail/example.com/user/cur/end -exec mv {} --target-directory=/home/example/mov_mail/ ';'
>>> script will move mails dated from 2011-06-19 to 2011-12-31 to the folder /home/example/mov_mail/
4) deleted the contents in the folder /home/example/mov_mail/
No comments:
Post a Comment