ftp the latest file from unix to windows

Hi,

I have a ftp script to ftp files from unix to windows. Now i need to pull the latest file from unix to windows. It is not working.

ftp -nvi $SERVER > ${FILE_DIR}/NavigationftpLog << EOD
user $USER $PWD

lcd $FILE_DIR
echo "the local directory is $FILE_DIR"

cd $Remote_PATH
echo "the remote library path is $Remote_PATH"
FILE_NAME=`ls -lt $Remote_PATH/output*|head -1|awk '{print $9}')
PUT $FILE_NAME

bye

EOD

This is not working. It is giving some errors.

Is there any method to include a piece of code in ftp script to get latest file.

Please advice!

What errors is it giving?

It is giving this message:

/opt/path/dev/data/output*:not found