sl@van-bc.UUCP (03/13/87)
The following is a reworking of the (un)compressdir scripts. Seems to work a little better, and only needs one copy. Cut and copy to compressdir, link to uncompressdir. Have fun and enjoy! Stuart Lynne Not a shar file ------------ cut here --------------- cut here --------- #! /bin/sh # # compress/uncompressdir # # Tom Rushworth # Stuart Lynne # Mar/87 # # # Modified from compress 4.0 release # OPTIONS= FILES= if test `basename $0` = "compressdir"; then EFLAG=-v COMPRESS=compress else EFLAG= COMPRESS=uncompress fi for ARG do case "$ARG" in -*) OPTIONS="$OPTIONS $ARG";; *) FILES="$FILES $ARG";; esac done if test -z "$FILES"; then FILES="." fi set $FILES find $@ -type f -links 1 -print | egrep $EFLAG '\.Z$' | while read FILE do if test -r $FILE -a -s $FILE then $COMPRESS $OPTIONS $FILE fi done -- Stuart Lynne ihnp4!alberta!ubc-vision!van-bc!sl Vancouver,BC,604-937-7532
scott@cdp.UUCP (03/23/87)
Here's a much faster (modulo the nice) version of compressdir/uncompressdir, for systems that have xargs. -scott : # ----------------------------- <cut here> ---------------------------- # # This is a shar archive. Extract with sh, not csh. # The rest of this file will extract: # compressdir # uncompressdir echo extracting - compressdir sed 's/^X//' > compressdir << '~FUNKY STUFF~' XOPTIONS= XFILES= Xfor ARG X do case "$ARG" in X -*) OPTIONS="$OPTIONS $ARG";; X *) FILES="$FILES $ARG";; X esac Xdone Xif [ -z "$OPTIONS" ] X then OPTIONS="-q" Xfi Xif [ -z "$FILES" ] X then FILES="." Xfi Xset $FILES X Xif [ ! -r $@ ] # file doesn't exist? X then exit 1 Xfi X Xfind $@ -type f -links 1 ! -name '*.Z' ! -name '?????????????*' -print | X xargs nice compress $OPTIONS >/dev/null 2>&1 ~FUNKY STUFF~ echo extracting - uncompressdir sed 's/^X//' > uncompressdir << '~FUNKY STUFF~' XOPTIONS= XFILES= Xfor ARG X do case "$ARG" in X -*) OPTIONS="$OPTIONS $ARG";; X *) FILES="$FILES $ARG";; X esac Xdone Xif [ -z "$FILES" ] X then FILES="." Xfi Xset $FILES X Xif [ ! -r $@ ] # file doesn't exist? X then exit 1 Xfi X Xfind $@ -type f -links 1 -name '*.Z' -print | X xargs nice uncompress $OPTIONS ~FUNKY STUFF~