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......
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
On 13 Feb 2019, at 11:10, Peter Chiochetti via dovecot <dovecot at dovecot.org> wrote:> ls | while read F; do echo $F; T=$(echo $F | cut -c 1-10); D=$(date --date="@$T" "+../../.Archive.%Y-%m/cur"); echo $D; donePerfect! (change date to gdate if your system is BSD based and your gnu tools are prefix with 'g') -- You know a thorn can main / But a lover does the same / A gem will reflect light / And a Fool will marvel at the sight / A fool such as me, /Who sees not the gold, but the beauty of the shine