5 # Send multiples files and/or directories as a tar/compressed
6 # image, in a MIME message.
12 # compression method (none, gzip or compress)
16 # uncompression filter
18 # compression description to append to content-type
21 # default compression method based on installed software
22 # prefer compress over gzip for backward compatibility
23 if command -v compress >/dev/null 2>&1 ; then
25 elif command -v gzip >/dev/null 2>&1 ; then
29 # handle command-line options to override compression method and delay
30 while [ $# -gt 3 ]; do
35 -compress) METHOD=compress
41 -*) DELAY="`echo $1 | sed -e 's%-%%'`"
49 # set variables based on chosen compression method
50 if [ $METHOD = compress ]; then
53 CONVERSION="; x-conversions=compress"
54 elif [ $METHOD = gzip ]; then
57 CONVERSION="; x-conversions=gzip"
60 if [ ! -z "$PERSON" ]; then
65 echo 'usage: sendfiles: "mailpath" "subject-string" directory-or-file ...' 1>&2
70 echo "mailpath = $mailpath" 1>&2
74 echo "subject-string = $subject" 1>&2
77 echo "files = $*" 1>&2
79 tar cvf - "$@" | $COMPRESS | \
80 %libdir%/viamail -to "$mailpath" -subject "$subject" \
81 -parameters "type=tar$CONVERSION" \
82 -comment "extract with $UNCOMPRESS | tar xvpf -" \