Skip to content

Instantly share code, notes, and snippets.

@vermiculus
Created July 6, 2015 03:18
Show Gist options
  • Save vermiculus/4dc2e514fbc152dc3c66 to your computer and use it in GitHub Desktop.
Save vermiculus/4dc2e514fbc152dc3c66 to your computer and use it in GitHub Desktop.
Turn a directory full of emails into timestamped org entries
for f in `ls *.eml`; do
eml_date=`grep Date: $f | head -n 1 | sed 's/.*, \(.*\) +.*/\1/'`
#gtouch -d "$eml_date" $f #update timestamp
org_date=`date -j -f '%e %b %Y %T' "$eml_date" "+[%Y-%m-%d %H:%M:%S]"`
echo "* $org_date `grep From: $f | head -n 1 | sed 's/.*: \(.*\)/\1/'`"
cat $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment