Hi,
I am very new in shell scripting. Have managed to prepare a script which will work to download data to local directory. But facing below problem. :wall:
Please help me out. Thanks in advance.
Problem:
-
I am unable to use delete command to delete data in the ftp location (I have permission to delete).
-
I don't want to download or delete data which are under precessing, file will have .curr extention.
complete file name sample: icdr.5_8_2A.0.1.201209131146.000014.0
complete file name sample: icdr.5_8_2A.0.1.201209131146.000014.curr
naming convention: icdr.version_number.zone_id.cdr_id.timestamp.sequence.new_sequence_indicator
my script:
#!/usr/bin/ksh
# CDR file location
SRC_1="/u01/raw/testcdr/"
#Credential
ipadd="myIPaddress"
user="userid"
pass="password"
remotedir="/cdr/ICDR/primary/"
pref="icd*"
TEMP_LIST_FILE="tempfilecheck_CDR"
FTPFLAGS="-n"
ftpresult1=`ftp $FTPFLAGS $ipadd <<EOF
user $user $pass
bin
prompt
cd $remotedir
nlist $pref $TEMP_LIST_FILE
bye
EOF`
for i in `cat $TEMP_LIST_FILE`;do
ftpresult2=`ftp $FTPFLAGS $ipadd <<EOF
user $user $pass
bin
prompt
cd $remotedir
lcd $SRC_1
mget $i
bye
EOF`
done