Archive maildir

Peter Chiochetti pch at myzel.net
Wed Feb 13 20:10:44 EET 2019


Am 13.02.19 um 15:44 schrieb Gandalf Corvotempesta via dovecot:
> Il giorno mer 13 feb 2019 alle ore 14:02 @lbutlr via dovecot
> <dovecot at dovecot.org> ha scritto:
>> Why would the script be looking at the contents of the messages at all? <uch css having to "deal" with the subject? If you are using maildir, you have the timestamp in the filename, and you can easily sort a message into yyyy.mm folders from there. You can also, considering the size of the mail isn't in the multi terabyte range, just use filtering to do this for you (filtering of tour choice, I'd guess most any filtering could handle it).
> 
> The script isn't made by me and i'm not a python programme, thus, i'll
> keep it as-is
> 
> I really prefere a bash one-liner......
> 

Here for a start

ls | while read F; do echo $F; T=$(echo $F | cut -c 1-10); D=$(date 
--date="@$T" "+../../.Archive.%Y-%m/cur"); echo $D; done

The file is in $F; the target directory is in $D; in front of the last 
semicolon you add

mkdir -p $D; mv $F $D

-- 
peter


More information about the dovecot mailing list