automail

Alejandro Liu acliu at skat.usc.edu
Sun Oct 29 01:53:39 AEST 1989


The following is a simple shell script to mail a large binary file.
It will uuencode the file and split it in files of a suitable size,
and then wrap each file in a shar, and mail each part in a separate,
message.  (The name auto mail seems a little bit misleading)  It is a
simple hack but sometimes useful when you want to mail large tar
compressed files...

----cute here----cute here----cute here----cute here----cute here----
#!/bin/sh
#Automail Written Oct 22, 1989, by Alejandro Liu to handle the mailing
#of large binary files.  Assumes a Unix system with the following programs:
# 	shar	uuencode	split	mkdir	rm -R
#and also the use the /tmp directory.  (This can be changed though)
#
# Warning, this script seems to fork a lot of processes.  So it is best if
# You use an non-audited system like a work station to run this.
#    :   :   :   :   :   :   :   :   :   :   :   :   :   :   :   :   :
CMD=`expr /xd/$0 : '.*/\(.*\)' \| /xd/$0`
if (test $# != 2) then
    echo Usage: $CMD filename recipient
    exit 1
fi
#
# Change this if there is no /tmp directory available.  Could be for
# example:  $HOME/.automail.$$
#
DIR=/tmp/.autom.$$
#
# SIZE of the each mail file in lines
#
SIZE=1200
#
FNAME=$1
DEST=$2
mkdir $DIR
uuencode $FNAME $FNAME > $DIR/$FNAME.uu
cd $DIR
split -$SIZE $FNAME.uu $FNAME.uu.
rm $FNAME.uu
NPARTS=`ls|wc -l`
PCOUNT=0
for PIECES in *
do
    PCOUNT=`expr $PCOUNT + 1`
    echo Mailing Part $PIECES
    shar -n$PCOUNT -e$NPARTS $PIECES | mail -s $PIECES $DEST
    rm $PIECES
done
rmdir $DIR
exit 0

Alejandro Liu
acliu%skat at usc.edu	acliu at skat.usc.edu
(Simple .signature, $CHEAP$)



More information about the Alt.sources mailing list