Script with error output but continuation in script?

I have written a basic fetching script. The script logs into an FTP site, downloads a .zip file, then unzips and moves the files to the necessary folders, then deletes them, etc.

The problem I have is if one of the files no longer exists on the FTP site or another part of the script fails, then the script can hang or just quits.

How can I incorporate some basic error-checking (that maybe outputs to a log file?) and then continues on with the script at different stages? Does anyone have any suggestions on what to start with?

Thanks a lot for any help! -Joe

Don't use ftp in scripts; it is designed for interactive use. Use an enhanced version such as one of the ncftp family.

Better still, use scp if you can.

Thanks for that! What's the difference between running scp in a script and ftp? I will probably use ncftp after looking into it. So outside of that, how can I base my script on unzipping files that may or may not be there?...and if so, move them?

Performing tasks conditional on a file being present:

if [ -f "filename" ]
then
    stuff
else
    other stuff
fi

Using scp:

if scp sourcefile username@destinationhost:destinationdir
then
    it worked
else
    it did not work
fi