tarmail enhancement
Mark Mendel
mark at hyper.UUCP
Tue Feb 25 11:05:48 AEST 1986
Brief summary of tarmail:
Part of the compress 4.0 distribution included nifty shell scripts tarmail and
untarmail. These allow entire directory hierarchies to be tar-ed, compressed,
converted to ascii (more compactly than uuencode) and mailed.
Enhancement:
Many mailers will refuse very large mail. I have added split
into the chain, dividing the mail into 700 line mailings. Each piece of
mail is about 55K.
Usage:
tarmail "mail subject" path!to!joe files_and_directories...
The receiver must save the mail in part number order to one or more files.
Then it types: (yes, types it does, 'cause it's not sexist...)
untarmail parts1-2 parts3-7 ...
The compress 4.0 distribution is available from the mod.sources archive, not
me.
#---------------------------- CUT HERE ----------------------------------
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# bin/tarmail
# bin/untarmail
echo Extracting bin/tarmail
sed 's/^X//' << 'SHAR_EOF' > bin/tarmail
X
Xif test $# -lt 3; then
X echo "Usage: tarmail mailpath \"subject-string\" directory-or-file(s)"
X exit
Xelse
X mailpath=$1
X echo "mailpath = $mailpath"
X shift
X subject="$1"
X echo "subject-string = $subject"
X shift
X echo files = $*
X tar cvf - $* | compress | btoa | split -700 - /tmp/tm$$
X n=1
X set /tmp/tm$$*
X for f do
X {
X echo '---start beef'
X cat $f
X echo '---end beef'
X } | Mail -s "$subject - part $n of $#" $mailpath
X n=`expr $n + 1`
X done
X rm /tmp/tm$$*
Xfi
SHAR_EOF
echo Extracting bin/untarmail
sed 's/^X//' << 'SHAR_EOF' > bin/untarmail
Xif test $# -ge 1; then
X sed '/^---end beef/,/^---start beef/d' $* | atob | uncompress | tar xvpf -
X mv $1 /usr/tmp/$1.$$
X echo tarmail file moved to: /usr/tmp/$1.$$
Xelse
X sed '/^---end beef/,/^---start beef/d' | atob | uncompress | tar xvpf -
Xfi
SHAR_EOF
exit
More information about the Comp.sources.unix
mailing list