#!/usr/bin/ksh # # 2mailfile - break up a big file, uuencode and mail it. # # When this script is executed, the system must have 'compress' # and 'uuencode' utilities available and pathed so the system # can read/execute them. # # You may Email any size large .tar file, executable or ASCII file # with this script. Output files will be approx 81,000 bytes each. # (the size of the output file may be changed, by changing the * split -nnnn) # # With this command you have the ability to send # any size file to any valid Interent address with ease. # # Example filename you want to send is: samplefile # Two arguments are required. # # 2mailfile samplefile cmanis@csoftec.csf.com # # # /usr/local/bin/mailfile - break up a big file, uuencode and mail it. # Fri Nov 13 11:10:42 CST 1992 - rcm@ProgCons.COM (Ron McDowell) # - cmanis@csoftec.csf.com (Cliff Manis) # # fixed to not try to compress a file if it already is compressed # Sat Nov 21 23:11:06 CST 1992 # # made it clean up after itself on abort. # fixed bug if there were more than 26 pieces to the file # Fri Dec 4 22:55:08 CST 1992 # case $# in 2) ;; *) echo `basename $0` usage: `basename $0` file addressee;exit 2;; esac tmpf=/tmp/mf$$ trap "rm -rf $tmpf" 1 2 3 9 15 if [ -f $1 ] then mkdir $tmpf||exit 1 cp $1 $tmpf||exit 1 cd $tmpf||exit 1 case $1 in *.Z) fil=$1;; *) fil=$1.Z;compress -f $1||exit 1;; esac uuencode $fil $fil >$tmpf/out||exit 1 split -1500 out||exit 1 for i in x?? do mailx -s "file:_$1_part_$i" $2 < $i echo "$0: $i sent to $2" done cd /tmp rm -rf $tmpf fi exit 0