#!/bin/sh
#
# # Copyright (C) 1989,1990,1991,1992 by
#	Wilfried Koch, Andreas Lampen, Axel Mahler, Juergen Nickelsen,
#	Wolfgang Obst and Ulrich Pralle 
# 
# This file is part of shapeTools.
#
# This software is published in the hope that it will be useful, but
# WITHOUT ANY WARRANTY for any part of this software to work correctly
# or as described in the manuals. See the ShapeTools Public License
# for details.
#
# Permission is granted to use, copy, modify, or distribute any part of
# this software but only under the conditions described in the ShapeTools 
# Public License. A copy of this license is supposed to have been given
# to you along with shapeTools in a file named LICENSE. Among other
# things, this copyright notice and the Public License must be
# preserved on all copies.

#

if [ $# -ne 2 ];
then
  echo Usage: $0 '<srcdir>' '<targetdir>';
  exit 1;
fi;

srcdir=$1;
targetdir=$2;

if [ ! -d $srcdir ] || [ ! -r $srcdir ] || [ ! -x $srcdir ];
then
  echo Can\'t access $srcdir;
  exit 1;
fi;

if [ ! -d $targetdir ] && [ ! -f $targetdir ];
then
  echo creating directory $targetdir;
  mkdir $targetdir;
fi;

dirs=`find $srcdir -type d -print | sed -e "s/$srcdir/$targetdir/" | \
tr '\012' ' '`;

for i in $dirs;
do
  if [ ! -d $i ] && [ ! -f $i ];
  then
    echo creating directory $i;
    mkdir $i;
  fi;
done;

exit 0;
