Created
November 24, 2010 11:58
-
-
Save berkes/713544 to your computer and use it in GitHub Desktop.
Archive certain IMAP directories with archivemail.
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
#! /bin/bash | |
# create archive directories: | |
archiveroot="$HOME/Archief/mail/" | |
dir="$archiveroot`date +%Y`/`date +%m`/`date +%d`/" | |
mkdir -p $dir | |
# set passwordfile, file should contain nothing but the password. | |
# You should at least make this file only readable by you. | |
pwfile=$HOME/Private/archivemailpw | |
# set location of thunderbirds local database. | |
globalmsg=.thunderbird/1vsl0pde.default/global-messages-db.sqlite | |
pattern="%@mail.example.com%" | |
for uri in `sqlite3 $globalmsg "SELECT folderURI FROM folderLocations WHERE folderURI LIKE \"$pattern\""`; do | |
archivemail \ | |
-d 60 \ | |
-o $dir \ | |
-u \ | |
--no-compress \ | |
-P $pwfile \ | |
# enable for testing -n -v \ | |
$uri ; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment