-
Get a text file "from.txt" from a FTP server.
#!/bin/ksh FTP_HOST=ftp.example.com FTP_USER=ftpuser FTP_PASS=pass123 FTP_DIR=/home/ftpuser FTP_FILE=from.txt DEST_DIR=/home/localuser DEST_FILE=to.txt JOB_LOG_FILE=example.log ftp -nv >> $JOB_LOG_FILE << EOFMARK open $FTP_HOST user $FTP_USER $FTP_PASS acsii get $FTP_DIR/$FTP_FILE $DEST_DIR/$DEST_FILE EOFMARK return 0
-
List the files in a directory from a FTP server.
#!/bin/ksh FTP_HOST=ftp.example.com FTP_USER=ftpuser FTP_PASS=pass123 FTP_DIR=/home/ftpuser FTP_FILE=from.txt FTP_TMP_FILE=ftp_temp.txt JOB_LOG_FILE=example.log ftp -nv >> $JOB_LOG_FILE << EOFMARK open $FTP_HOST user $FTP_USER $FTP_PASS cd $FTP_DIR prompt off ls * $FTP_TMP_FILE EOFMARK return 0
A blog to log all the findings I have found during my programming life before I forget. ^.^
17 Jan 2013
FTP in KSH
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment