Wednesday, April 6, 2011

Shell Script to get a data file based on date via FTP

FTP from a AIX server and get a file based on date. Cool scripted tested extensively. It works like a charm.

TIME=$(date +%k%M)
DAY=`/bin/date +%Y%m%d`
echo $DAY
file_name=Prefix_${DAY}_suffix
echo "File name to pick " $file_name

src_ip="x.x.x.x"
src_user="user name"
src_password="password"
dir_path="Directory path of the file to pick"

#!/bin/csh

ftp -n $src_ip << EndFTP
user $src_user $src_password
cd $dir_path
bin
hash
mget $file_name
EndFTP

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.