hi All
i need to automate the process of FTPing the source file from remote host to the local directory. i am writing the shell script to FTP the latest file from the remote directory. but the general ls -1t |tail -1command does not work in the ftp part. what is the command to pick the latest or last file when we do ls -1t ?
this is how my script looks
#!/bin/sh
#variables
#define local data dir
local_data_dir=.................
#remote dir and host properties
remote_dir=
remote_host=
user=
password=
clear
#define ftp host and user information
host=
userid=
password=
#ftp to DC and get the pgp file
echo Starting FTP
ftp -n $remote_host << END_FTP
user $user $password
cd toremotedir
put "ls -l" files.list
bye
END_FTP
echo FileName
#echo file $pgp_file recieved at $local_data_dir
echo
#get $remote_dir/$pgp_file $local_data_dir/$pgp_file
#change dir to loacl data dir
#cd $local_data_dir
#identify most recently generated pgp file
#pgp_file=`ls -tr *.pgp|tail -l`
#define decrypted filename w/ extension '.xml'
#xml_file=$pgp_file.xml
the ftp part in the script is not retirning the file.
thanks.
unix ftp script
Moderators: chulett, rschirm, roy