# Name : ~/.csh/backup.floppy # Type : Cshell script from s375 # Fuction: Backup directories to msdos floppy # Bugs: Your tree of names must be msdos compliant # ie names must be <= 8alphanums.3alphanums # with no fancy names such as aux: or con:, # fred and FRED will collide ! # - - - - - - - - - - # Use temporary names typically of type /usr/tmp/backup.floppy.5381.stop.lst set TMP=/usr/tmp/`basename $0`.$$ echo Temporary filenames based on $TMP. # Prevent anyone nosing at lists of your back up tree structure. umask 077 echo if youve got more than around 720K this wont work echo remember du reports in 512 byte units foreach j ( $* ) echo Doing $j. du -s $j echo Making floppy directories. # tail +2 removes the . entry find $j -type d -print | sort | tail +2 > $TMP.dir.lst foreach i ( `cat $TMP.dir.lst` ) mmd $i end rm $TMP.dir.lst echo Ensuring msdos batch script lines terminate with CR LF. find $j \( -type f -o -type l \) \( -name \*.bat \) -exec addcr -d {} \; echo Decompressing any .Z files. # Ensure we dont get a decompressed & compressed copy of same thing on Msdos, # avoid sending compressed files, also my msdos doesnt have compress yet, # also fred.c.Z is not a valid msdos file name find $j \( -type f -o -type l \) \( -name \*.Z \) -exec uncompress {} \; echo 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 $j \( -type f -o -type l \) -print | sort > $TMP.full.lst /usr/bin/local/ls -RX $* | grep -v \.Z\$ | sort > $TMP.full.lst echo Avoiding sending unwanted files. - Generating stop list. find $j \( -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 echo Subtracting stop list from full list. comm -23 $TMP.full.lst $TMP.stop.lst > $TMP.final.lst echo Writing files. find . -type d -print | sort > $TMP.dir.lst foreach i ( `cat $TMP.final.lst` ) mwrite $i $i end rm $TMP.final.lst rm $TMP.full.lst $TMP.stop.lst echo Looking at top directory, and seeing how much space on floppy. mdir #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 echo End of doing $j loop. end