Created
August 30, 2012 05:00
-
-
Save nikushi/3522545 to your computer and use it in GitHub Desktop.
受信メールを日付フォルダにコピーするmaildropレシピ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HOME="/home/nikushi" | |
ARCHIVEBASE="$HOME/Maildir.Archives" | |
# parse Date: value | |
D=`egrep ^Date: | \ | |
sed -e 's/^Date: *//' | \ | |
perl -MDate::Parse -ne 'print Date::Parse::str2time("$_")' \ | |
| perl -ne '@t=localtime($_); printf("%d%02d%02d",@t[5]+1900,@t[4]+1,@t[3])'` | |
if ( "$D" eq "" ) | |
{ | |
log "[WARN] D=$D, cannot get date on Date header, this mail is not archived." | |
cc "/dev/null" | |
} | |
else | |
{ | |
OUT="$ARCHIVEBASE/.$D" | |
RET=`[ ! -d $OUT ] && /usr/local/bin/maildirmake $OUT && echo $OUT created` | |
log $RET | |
cc $OUT | |
} | |
#to "/dev/null" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment