if test $# -ne 2     #Input and Output directory parameters
   then echo Missing input and output directory names 
        exit
fi
trouble="N"
for i in $*
do
    if test ! -s $i
       then echo $i not found or 0 bytes 
            trouble="Y"
            continue
    fi
    if test ! -r $i
       then echo You do not have read permission on $i
            trouble="Y"
            continue
    fi
    if test ! -x $i
       then echo You do not have execution permission on $i
            trouble="Y"
            continue
    fi
    if test ! -d $i
       then echo $i is not a directory
            trouble="Y"
    fi
done
if test $trouble == "Y"
   then exit
fi
for inputFile in `ls -l $1 | grep "^-" | awk '{print $(NF)}'`
do
    if test ! -f $1/$inputFile       #It's not an ordinary file
       then continue
    fi
    if CPROGRAM < $1/$inputFile > $2/$inputFile
       then rm $1/$inputFile
    fi
done
