#!/bin/sh

# Script to create the FTP download script
#
# Farshad Nayeri, 4 December 1996
#
# Instructions:
# Run this script, redirecting output to
# a file. Download the file to the remote
# machine, and then redirect it as input
# to an ftp session.
#
# Note: both systems must have a /proj/cmass/CD.



# Startup info and options

echo 'open play.cs.columbia.edu'
echo 'farshad'
echo 'cd /proj/cmass'
echo 'lcd /proj/cmass'
echo 'prompt'     
echo 'verbose'
echo 'hash'
echo 'bin' 


echo ''
echo '!echo ==============================='
echo '!echo ======= CD FTP  Download ======'
echo '!echo ==============================='

echo ''
echo '!echo'
echo '!echo Script Generated' `date`
echo '!echo              on ' `hostname`
echo '!echo              by ' ${0} 'with option' $1
echo '!echo'
echo ''

cd /proj/cmass

# create the directory skeleton

echo ''
echo '!echo ==============================='
echo '!echo ====== Creating Skeleton ======'
echo '!echo ==============================='

find CD ${1} -name '*' -type d -exec echo \!mkdir {} \; | sort 

# download all the files

echo ''
echo '!echo ==============================='
echo '!echo ====== Downloading files ======'
echo '!echo ==============================='

find CD ${1} -name '*' -type f -exec echo get {} \; | sort

echo 'bye'
