if [[ -a file*.ach || -a file2 ]] #check if files exist then set +x #turn on debug echo "***********************************************************" echo "** The file*.ach and/or file2 file already exists. **" echo "***********************************************************" exit 99 #if the any one of two files exist exit program else set +x echo "*************************************" echo "** No files exist, continueing on. **" echo "*************************************" set -x fi #no files then run the ftp job. ftp -vin << EOD open 9.9.9.9 #ip of ftp server user DOMAIN\/user1 password321 # DOMAIN\user then password Microsoft domain login case prompt cd directory1\/directory2 mget file*.ach quit EOD