Applied Simon Burge <simonb@thistledown.com.au>'s dtimep.lex patch:
[mmh] / etc / sendfiles
1 #!/bin/sh
2 #
3 # $Id$
4 #
5 # Send multiples files and/or directories as a tar/compressed
6 # image, in a MIME message.
7 #
8
9 DELAY=0
10 FROM=
11
12 case "$1" in
13     -*) DELAY="`echo $1 | sed -e 's%-%%'`"
14         shift
15         ;;
16 esac
17
18 if [ ! -z "$PERSON" ]; then
19     FROM="-from $PERSON"
20 fi
21
22 if [ $# -lt 3 ]; then
23     echo 'usage: sendfiles: "mailpath" "subject-string" directory-or-file ...' 1>&2
24     exit 1;
25 fi
26
27 mailpath="$1"
28 echo "mailpath = $mailpath" 1>&2
29 shift
30
31 subject="$1"
32 echo "subject-string = $subject" 1>&2
33 shift
34
35 echo "files = $*" 1>&2
36
37 tar cvf - "$@" | compress | \
38     viamail -to "$mailpath" -subject "$subject" \
39         -parameters "type=tar; x-conversions=compress" \
40         -comment "extract with uncompress | tar xvpf -" \
41         -delay "$DELAY" \
42         -verbose $FROM