This will find all files inside the /root/remote/ and rename it to .done
and uploads them one by one.
#!/bin/bash
ls /root/remote/*.txt > /root/remote/files
cd /root/remote
for i in `ls *.txt`;do mv “$i” “`basename $i .txt`.done”; done
for f in *.done; do
ftp -inv test.com<<ENDFTP
user username password
cd test
lcd /root/remote
put $f
bye
ENDFTP
done