This script can be used to upload all .txt files from a folder to your ftp.
#!/bin/bash
#var Hostname
HOST='localhost'
#var Username
USER='root'
#Path to data on FTP
FTPPATH=/var/ftp/
#Path to local .txt files
FILEPATH=/var/textfiles/*.txt
#Connect to FTP via SecureFTP (SSH needed) and upload files from FILEPATH to FTPPATH
sftp -b - ${USER}@${HOST} << EOFFTP
put $FILEPATH $FTPPATH
quit
EOFFTP