Basic shell script
#!/bin/bash
#The following line points to where the PingER measurements are to be found
cd /afs/slac.stanford.edu/u/sf/pinger/ftp
HOST=ftp.slac.stanford.edu #This is the FTP servers host or IP address.
USER=anonymous #This is the FTP user that has access to the server.
PASS=saqibutm@outlook.com #This is the password for the FTP user.
# Call 1. Uses the ftp command with the -inv switches.
#-i turns off interactive prompting.
#-n Restrains FTP from attempting the auto-login feature.
#-v enables verbose and progress.
ftp -invp $HOST << EOF
# Call 2. Here the login credentials are supplied by calling the variables.
user $USER $PASS
cd incoming
cd pinger
mkdir temp
cd temp
dir
binary
put ping-2018-05.txt
dir
quit
# End FTP Connection
bye
EOF
Results from shell script
retaylor:Desktop cottrell$ bin/copy.sh bin/copy.sh: line 2: cd: /afs/slac.stanford.edu/u/sf/pinger/ftp: No such file or directory Connected to ftp.slac.stanford.edu. 220-=========================================================================== 220- NOTICE TO USERS 220- ... 220-=============================================================================== 220 FTP server ready. 331 Anonymous login ok, send your complete email address as your password 230-==================================================================== 230- 230-Stanford Linear Accelerator Center Anonymous FTP Server 230- 230-==================================================================== 230- ... 230-==================================================================== 230-Anonymous access granted, restrictions apply 230-Please read the file README 230- it was last modified on Wed Nov 27 02:12:42 2002 - 5678 days ago 230-Please read the file README.LC02 230- it was last modified on Mon Jan 28 22:48:21 2002 - 5981 days ago 230-Please read the file README.incoming 230- it was last modified on Thu Nov 14 19:38:30 2002 - 5691 days ago 230-Please read the file README.outgoing 230- it was last modified on Mon Mar 10 20:52:44 2003 - 5575 days ago 230-Please read the file README.tip_inbox 230 it was last modified on Fri Jul 6 22:09:28 2001 - 6187 days ago Remote system type is UNIX. Using binary mode to transfer files. 250-CWD command successful 250-Please read the file README 250 it was last modified on Thu Nov 14 19:38:30 2002 - 5691 days ago 250 CWD command successful 257 "/incoming/pinger/temp" - Directory successfully created 250 CWD command successful 229 Entering Extended Passive Mode (|||35662|) 150 Opening ASCII mode data connection for file list dr-xr-xr-x 2 ftp ftp 2048 Jun 14 14:41 . dr-xr-xr-x 6 ftp ftp 2048 Jun 14 14:41 .. 226 Transfer complete 200 Type set to I local: ping-2018-05.txt remote: ping-2018-05.txt 229 Entering Extended Passive Mode (|||45972|) 150 Opening BINARY mode data connection for ping-2018-05.txt 100% |************************************************************| 70241 KiB 41.66 KiB/s 00:00 ETA 226 Transfer complete 71927591 bytes sent in 28:10 (41.55 KiB/s) 229 Entering Extended Passive Mode (|||45625|) 150 Opening ASCII mode data connection for file list dr-xr-xr-x 2 ftp ftp 2048 Jun 14 14:41 . dr-xr-xr-x 6 ftp ftp 2048 Jun 14 14:41 .. -r--r--r-- 1 ftp ftp 71927591 Jun 14 15:09 ping-2018-05.txt 226 Transfer complete 221 Goodbye. retaylor:Desktop cottrell$ ssh pinger@pinger.slac.stanford.edu pinger@pinger.slac.stanford.edu's password: Last login: Thu Jun 14 08:12:15 2018 from adsl-99-152-56-78.dsl.pltn13.sbcglobal.net =============================================================================== NOTICE TO USERS This is a Federal computer system and is the property of the United States ... =============================================================================== RHEL Workstation 6.4 (Santiago) 2.6.32-696.18.7.el6.i686 (4x2599MHz VMware Virtual Platform) =============================================================================== pinger@pinger $ ls -l /afs/slac/public/incoming/pinger/ total 127029 -rw-r--r-- 1 32766 nobody 58141147 Jun 13 15:01 ping-2018-04.txt -rw-r--r-- 1 32766 nobody 71927591 Jun 13 15:03 ping-2018-05.txt drwxr-xr-x 3 pinger sf 2048 Jun 12 10:06 proxy/ drwxr-xr-x 2 NO-OWNER nobody 2048 Jun 13 12:44 saqib/ drwxr-xr-x 2 32766 nobody 2048 Jun 14 07:41 temp/ drwxr-xr-x 2 NO-OWNER nobody 2048 Jun 13 14:50 test/ pinger@pinger $ ls -l /afs/slac/public/incoming/pinger/temp total 70242 -rw-r--r-- 1 32766 nobody 71927591 Jun 14 08:09 ping-2018-05.txt pinger@pinger $