#!/bin/csh # Warning: As well as being a working Csh script # THIS SCRIPT AUTO. INCLUDED IN TRANSFER MANUAL - SO TAKE CARE ! # Name : ~/bin/bak # Type : Cshell script # Fuction: Find trees of files & transfer them via serial line to msdos # for backup. # Author: Julian Stacey # Syntax: bak one_or_more_directory_or_file_names # Bugs - Addcr & stop_list not done for files in symbolically linked # directories. # - If 2 processes are run on the same directory_or_file_names, # addcr will get called twice, addcr doesnt have lock until read # complete facility, so .bat files may get corrupted. # (A similar problem may occur with compressed .Z files). # Copyright: Julian Stacey 1989 # - - - - - - - - - - # Use temporary names typically of type /usr/tmp/bak.5381.stop.lst set TMP=/usr/tmp/`basename $0`.$$ # Prevent anyone nosing at lists of your back up tree structure. umask 077 # Turn echoes off, (otherwise if msdos pc ceases running kermit, starts running # transfer whilst unix is running finds, before unix later gets round to running # also running transfer, the pc sends R, unix echoes R, msdos pc concludes it # has discovered a transfer program also in receive mode, and aborts. stty -echo # Ensuring msdos batch script lines terminate with CR LF." find $* \( -type f -o -type l \) \( -name \*.bat \) -exec addcr -d {} \; \ >& /dev/null # Ensure we dont get a decompressed & compressed copy of same thing on Msdos, # avoid sending compressed files, also my msdos doesnt have compress yet. find $* \( -type f -o -type l \) \( -name \*.Z \) -exec uncompress {} \; \ >& /dev/null # Generating full list. # The find below doesnt find files in symbolically linked directories, so # is patched out until either I can figure out a change of find syntax to # get it to do so, or until find binary is upgraded. # find $* \( -type f -o -type l \) -print | sort > $TMP.full.lst /usr/bin/local/ls -RX $* | grep -v \.Z\$ | sort > $TMP.full.lst # Avoid sending unwanted files. - Generate stop list. find $* \( -type f -o -type l \) \ \( -name \*.err -o -name \*.log -o -name \*.lnt \ -o -name \*.lst -o -name a.out -o -name \*.o -o -name \*.a \ -o -name core -o -name t -o -name x -o -name z -o -name 1 \ -o -name 2 -o -name 44 -o -name 49 -name t.c \) -print | sort \ > $TMP.stop.lst # Subtracting stop list from full list. comm -23 $TMP.full.lst $TMP.stop.lst > $TMP.final.lst # by now msdos should be running transfer -r -e (or similar). cat $TMP.final.lst | transfer -s -f- stty echo rm $TMP.final.lst rm $TMP.full.lst $TMP.stop.lst >& /dev/null #explanation of names removed from transferable list # .lnt lint output from my makefile # .lst nroff output from my makefiles; transfer lists # .log transfer log files # .err my name for msc compiler err log file # a.out \*.o \*.a unix compiler binaries of no interest to msdos archive # .Z compressed files # core unix core dumps of no interest to msdos archive # t z 1 2 temporary human / vi / buffer names # 44 49 temporary lprset/vi names