Automate FTP on UNIX using a shell script

Some instructions on how to automate FTP on UNIX using a shell script.

http://www.stratigery.com/scripting.ftp.html

 

#!/bin/sh HOST='{ip address or server name}’ USER='{user ID}’ PASSWD='{password}’ FILE='{name of file to be sent}’

 

cd /data/mk/ns/traffic_analysis  {Don’t know how to use ftp commands very well – was easier to change to the directory where the file was located first}

 

ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD put $FILE quit END_SCRIPT exit 0 {Then whatever other commands are needed next – i needed to remove the file from my server, then change back to the originating directory} rm output.csv cd /usr/local/docs-internal/bins/mk/ns