Monday, March 5, 2012

Automated/Scripted FTP

References:

Basic FTP commands | http://www.cs.colostate.edu/helpdocs/ftp.html
Introduction to FTP | http://opcenter.cites.uiuc.edu/nas/nash/apps/ftp.html


#!/usr/bin/ksh


# AUTHOR - Ajith Singh
# e-MAIL - singh.ajith@gmail.com
# PURPOSE - Script to automate the FTPing of files
# DATE - 05-Mar-2012


FTPHOST=10.10.10.221
FTPUSR="ajiths"
FTPPWD="secret"
REMOTE_DIR=/savevg_backup1
LOCAL_DIR=/tsm/dbbu
FILES="30724044.dbb 30726576.dbb 30728892.dbb 30722524.dbb 30725309.dbb 30727614.dbb 30730219.dbb"


ftp -v -n $FTPHOST << _FTPCMDS        

user $FTPUSR $FTPPWD  
prompt      
verbose        
binary        
cd $REMOTE_DIR        
lcd $LOCAL_DIR        
mget $FILES quit
_FTPCMDS