#!/bin/sh # gmv, boone, 02/15/93 # Move gopher documents with their .cap files # Copyright (C) 1993, Trustees of Michigan State University if [ $# -ne 2 ] then echo "Usage: $0 source dest" exit 1 fi # If input file/directory exists if [ \( -f $1 \) -o \( -d $1 \) ] then # Output must be a directory if [ ! -d $2 ] then echo "$0: Destination must be a directory" exit 2 fi echo "$0: Moving $1 to $2" mv $1 $2 indir=`dirname $1` indir=${indir-`pwd`} infile=`basename $1` incap="$indir/.cap/$infile" outcapdir="$2/.cap" outcap="$2/.cap/$infile" if [ -f $incap ] then if [ ! -d $outcapdir ] then mkdir $outcapdir fi echo "$0: Moving .cap file $incap to $outcap" mv $incap $outcap fi else echo "$0: Input file $1 does not exist" exit 2 fi