append date time stamp via ftp script

I have searched several thread and not found my solution, so I am posting a new qustion.

I have a very simple script on an AIX server that FTPs 2 files to a MS FTP server. These 2 files are created on the AIX server every hour, with a static name.

I need to FTP the files to the MS server, but append the date/time to the file name. We have run into a situation where the job that is to pick the files up from the MS FTP server failed, and when my script ran it wrote over the files.

I would like to know how best to accomplish this. If I rename the file while it is on the AIX server, how would I tell the FTP script what the name is?

I assume I need to tell the FTP script; here is the file to ftp, rename it with the date/time, then FTP it, but I am stuck.

You may guess I am not a scripting/programming guru by any means.

Thanks!

Your AIX filenames are static: for this example assume it is filename

#!/bin/ksh
fname="filename"
newname=$(basename "$fname")$(date +"%Y%m%d:%H%M%S")
/usr/bin/ftp << EOF
 open 1.10.1.1
 user username password
 put $name $newname
 bye
EOF