Hi,
I'm using the first approach fetching filenames and then determining files which I need to fetch.
I'm connected to the FTP and by using ls -l listing the filenames to local file. And then I'm doing some formatting and removed more than one day old files names. I have done while loop on the filesnames and prepared a string of file names and using that string to get files from FTP site.
I have given final command as
mget "abcd.txt" "efgh.txt" "ijkl.txt"
But this command pulling all the files from the directory.
I tried get command, but its not working.
my script looks like below.
**********************
#! /bin/ksh
printf "open $HOST \n" > ftp.cmd
printf "user $USER $PASSWD\n" >> ftp.cmd
printf "bin\n" >> ftp.cmd
printf "cd Models\n" >> ftp.cmd
printf "prompt\n" >> ftp.cmd
printf "ls -l excel_list.txt\n" >> ftp.cmd
printf "bye\n" >> ftp.cmd
ftp -n < ftp.cmd
rm *.cmd
sed 's/\(01-06-09\.[a-zA-Z0-9_]*\)/\
\1\
/g' excel_list.txt|grep '^01-20-09' >> listDates1.txt
sed 's/[0-9][0-9]-[0-9][0-9]-[0-9][0-9].*[0-9][0-9]:[0-9][0-9][A-Z][A-Z]/ /g' listDates1.txt >> listDates2.txt
sed 's/^ *//g' listDates2.txt >> listDates3.txt
sed 's/^[0-9][0-9]*//g' listDates3.txt >> listDates4.txt
sed 's/^ *//g' listDates4.txt >> excel_files.txt
FTP_LIST=''
while read files
do
FTP_LIST=$FTP_LIST'"'$files'" '
done < "excel_files.txt"
printf "open $HOST \n" > ftp.cmd
printf "user $USER $PASSWD\n" >> ftp.cmd
printf "bin\n" >> ftp.cmd
printf "cd Models\n" >> ftp.cmd
printf "prompt\n" >> ftp.cmd
printf "get $FTP_LIST\n" >> ftp.cmd
printf "bye\n" >> ftp.cmd
ftp -n < ftp.cmd
rm .cmd
********************
Can you suggest how get selected files using FTP.
Thanks