#! /bin/sh
# fmcopy 2.0 (c) 1987-1989 Frame Techology
# 2/27/87 by stk
# Command to cp -r a complete directory structure including links.
# The second argument should be a directory to place the directory
# in the first argument. It is made if it doesn't exist.
if [ $# != 2 -o ! -d "$1" ]; then
	echo "Usage: fmcopy <source directory> <destination directory>

This command copies the contents of the source directory into
the destination directory (creating it if needed).
This command is similar to cp -r <dir1> <dir2>
except that it will CORRECTLY duplicate the entire structure of the
directory including preserving symbolic links! Use this command to 
copy FrameMaker from one filesystem to another (use the mv command
if you are within the same filesystem).

Example:

	fmcopy /usr/server1/local/frame /usr/local/frame

will make a copy of '/usr/server1/local/frame' called '/usr/local/frame'.

Caution: if a file in the source directory does not have read permission,
a new file will be created with zero length in the destination directory.
"
	exit 0
fi
echo "fmcopy 2.0"
echo "Putting the contents of the directory \"$1\" into the directory \"$2\"..."
if [ "$PWD" = "" ]; then
	cwd=`pwd`
else
	cwd=$PWD
fi
export cwd
# If destination directory doesn't exist, make it.
[ -d $2 ] || {
	echo Making directory $2
	mkdir $2
}
# You don't want to tar from $1 directly since $1 might be an absolute path name.
# So you wouldn't be creating relative files
cd $1
tar cf - . | (cd $cwd; cd $2; tar xvfoFlpB -)

