The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 07-16-2008
dog123 dog123 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 1
No return code in ftp mget script

I have a automated FTP script that gets a file using mget. I am using mget because the date will change on the file frequently. The mget works, however if I incorrectly type the file (e.g. if I want to get /dog123 and I enter /dg*) I do not receive and error code from in the FTP session. The script works fine, however if I incorrectly type the location ($ftp_source) I want to receive an error saying the file was not found. Any thoughts?

I am trying to get the file /dog123 however I have purposely given the incorrect $ftp_source /dg* I would like receive an error.

if [ "$ftp_type" = "mget" ]
then
ftp -dinv <<End_FTPSession 1>$FTPLOG 2>>$FTPLOG
open $ftp_hostname
user $ftp_username $ftp_password
lcd $ftp_local_dir
$ftp_mode
#FTP mode is binary
$ftp_type $ftp_source
#type is mget, source is /dg*
close
quit
End_FTPSession
fi


###########LOG FILE##########

331-(----GATEWAY CONNECTED TO ftp.blah.com----)
331-(220-Microsoft FTP Service)
331-(220 IWUESSISIII (Customer FTP))
331 Password required for test12.
---> PASS
230 User test12 logged in.
Local directory now /home/dev
---> TYPE I
200 Type set to I.
---> PORT 172,25,109,67,169,33
---> TYPE A N
---> NLST /dg*
---> TYPE I
---> QUIT
221



#Just quits, I would like to receive a 550 error (550 dg*: No such file or directory: No such file or directory.)