-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzipmail
executable file
·69 lines (63 loc) · 2.07 KB
/
zipmail
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
#
# zipmail - Converts Maildir to mbox and compresses
# Copyright (C) 2000 Chris Gushue <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the license, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# $Id: zipmail,v 1.6 2000/09/01 18:56:03 seymour Exp $
#
# This script requires maildir2mbox, which is part of qmail
#
# It has worked for me for the past 3 months, but I still
# make no guarantees as to its safety. If you wish to use it,
# any loss of mail is your problem and not mine.
#
# I run it from cron as follows:
#
# # Run on the 2nd day of every month (converts/compresses last month's mail)
# 30 04 2 * * /home/seymour/.mutt/zipmail `/home/seymour/.mutt/mailmonth 1`
PATH="/usr/local/bin:/usr/bin:/bin"
WHERE="/home/grigouze/Mail"
# What folder of Maildir boxes do we want to process?
# (In my case, which month - ~/mail/2000/08 for example)
if [ -z $1 ]; then
WHAT=`/home/grigouze/.mutt/mailmonth 1`
else
WHAT=$1
fi
cd $WHERE/$WHAT
echo "Backing up $WHERE/$WHAT:"
for folder in *
do
if [ -d $folder ]; then
echo " $folder"
# Set up variables for maildir2mbox
export MAILDIR="$WHERE/$WHAT/$folder"
export MAIL="$WHERE/$WHAT/$folder.txt"
export MAILTMP="$WHERE/$WHAT/$folder.tmp"
# Run it...
/home/grigouze/.mutt/maildir2mbox
# Clean up and compress
if [ -f $folder.txt ]; then
rm -rf $folder
mv $folder.txt $folder
gzip $folder
fi
else
echo " <$folder>"
fi
done
echo "done."