Ftp

FTP_path=""

cd $FTP_path
Source_path=""
Ftp -ni ${hostname}<<!
destusername="XXX"
destpass="XXX"
user ${destusername} ${destpass}
cd $Source_path
for i in `ls -ltr <filename>*.dat`;do
put $i
Done

the above script is giving an error -Askin for correct user name and password saying authentication failed, when i change the code
as
FTP_path=""

cd $FTP_path
Source_path=""
Ftp ${hostname}
cd $Source_path
for i in `ls -ltr <filename>*.dat`;do
put $i
Done
its promptilng for username and password and iam getting the ftp prompt and ican put files . what will be the problem please reply

  1. use $HOME/.netrc for username/password

  2. ftp does not support the following

for i in `ls -ltr <filename>*.dat`;do
 put $i 
 Done

you would need to prepare the list of files using shell and pipe the commands in as stdin