No return code in ftp mget script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting No return code in ftp mget script
# 1  
Old 07-16-2008
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.)
# 2  
Old 04-27-2009
Did someone find any solution for this ?
I have the same problem trying to catch error from an mget in a FTP cession...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to capture 3 digit return code of ftp??

is it possible to capture the 3 digit return code of ftp commands in a local variable inside a shell script? Code: ftp remoteserver << EOFTP quote USER uid quote PASS pass prompt cd remote_directory mput file.txt bye EOFTP in the above script, if cd ... (4 Replies)
Discussion started by: Little
4 Replies

2. UNIX Desktop Questions & Answers

ftp return code not working

below is my code , but for some reason the return part is not working, only file transfer is happening and no exit status is checked .please me help me to fix this code #!/bin/sh #set -vx ftp -nv sitelocation << ! user username password lcd localdir cd /remote dir mget *.* ... (4 Replies)
Discussion started by: gwrm
4 Replies

3. AIX

ftp mget directory

Hi, I have searched everywhere for an answer to this question but couldn't find one so I ask it here. From an AIX 5.3 machine I ftp to another AIX 5.3 server. I want to get all files and only files in a directory. This directory has a subdirectory with files in it. In ftp, I enter the... (5 Replies)
Discussion started by: bheinsius
5 Replies

4. Shell Programming and Scripting

Ftp-mget

For the below mentioned code..Files are getting transferred from first mget statement alone ie from /home/Arun/*EF01/...Could someone help me regarding this ftp -vn <<EOD >$LOG open user lcd ascii mget /home/Arun/*EF01/GLHEC* mget /home/Arun/*EF03/GLHEC* mget... (3 Replies)
Discussion started by: infernalhell
3 Replies

5. Shell Programming and Scripting

shell script - ftp downloading serveral files without mget

Hello guys, i'm searching for a solution how to download all files from root-directory of an ftp-server through an ftp proxy getting through the ftp proxy and download one file with get ist no problem, but mget * does nothing! ftp -n -i -v <<EOF open proxyHost proxyPort user... (19 Replies)
Discussion started by: macProgger23
19 Replies

6. UNIX for Dummies Questions & Answers

FTP Return Code

Hi All, I have a problem to identify the error code thrown by FTP Server while uploading files. The message is : ftp return 32. I couldn't find out what is the meaning of that. :confused: OS is Sun Solaris 2.10. Anyone can help? Thanks a lot (1 Reply)
Discussion started by: wilsonSurya
1 Replies

7. Shell Programming and Scripting

capture ftp return code..PLZ HELP

Hi all, i have written a code to ftp a file from one server to other.The ftp is happeneing successfully,but i am not able to capture the return code,to check if ftp has failed. plz help me to find out the return code....this is urgent below is the code i have written... (3 Replies)
Discussion started by: anju
3 Replies

8. Programming

getting the return code of forked child process (ftp)

Hi, From within my C++ program, I fork a child process and execl an ftp session (solaris), like this : std::string szStartCmd = "ftp -i -n -v 192.168.149.31"; int nExecRes = execl("/bin/sh", "sh", "-c", szStartCmd.c_str(), (char *)0); I use 2 pipes to communicate between my... (7 Replies)
Discussion started by: KittyJ
7 Replies

9. UNIX for Advanced & Expert Users

return code on ftp if filesystem full??

Does anyone know what the return code will be if an ftp fails because the /var/tmp filesystem is full? AIX 4.3 (1 Reply)
Discussion started by: lawadm1
1 Replies

10. UNIX for Dummies Questions & Answers

mget (ftp command)

hey, I was wondering if its possible to use a complete path and file name using the mget command example mget /dir1/dir2/dir3/file.ext or get /dir1/dir2/dir3/file.ext because whenever i try its says file not found or permission denied..... but if i do cd dir1 cd dir2 cd dir3 mget... (2 Replies)
Discussion started by: Ganondorf
2 Replies
Login or Register to Ask a Question