FTP - To handle error while transferring files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP - To handle error while transferring files
# 1  
Old 04-04-2007
FTP - To handle error while transferring files

Hi,
I had written an FTP script where in I loop through the directories and transfer the files from each and every directory of Windows to UNIX.

Now the problem is when

1. The connection is unable to be established I should return some error codes

2. When there is some system problem and the FTP doesnt happen also the error condition should be handled

I would like to know whether there are any ways to handle the error codes for all the above conditions.

I am currently modified the code to handle the problem like this in the following ways.

ftp -v -n -i ${IP_ADDRESS} <<==eoftp== >> $LOGFILE 2>&1
user ${USERID} ${PASSWORD}
lcd ${1}
cd ${2}
put ${3}
bye
==eoftp==
ret_val=$?
echo "After ftp: `date '+%d/%m/%Y %T'`" |tee -a $LOGFILE 2>&1
echo "ret_val..= ${ret_val}" |tee -a $LOGFILE 2>&1
if [[ ${ret_val} -ne 0 ]]
then
echo "FTP failed..." |tee -a $LOGFILE 2>&1
else
echo "FTP Successful..." | tee -a $LOGFILE 2>&1
fi


Do let me know the other codes to be checked for proper functionality with check for exceptions

Thanks
Mahalakshmi.A
# 2  
Old 04-04-2007
have a look here, might help you
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Transferring files to directories

I have a large number of files with file names of the format iv.epoz.hhe.d.2018.028.000000.sac iv.epoz.hhn.d.2018.028.000000.sac iv.epoz.hhz.d.2018.028.000000.sac iv.epoz.hhe.d.2018.029.000000.sac iv.epoz.hhn.d.2018.029.000000.sac iv.epoz.hhz.d.2018.029.000000.sac... (4 Replies)
Discussion started by: kristinu
4 Replies

2. Shell Programming and Scripting

How can we overcome Broken pipe error during scp,SFTP,Rsync while transferring big files.?

Hello All, Hope all are doing well. We use scp (some times sftp and rsync also) for transferring big files (around 2GB each ) from 1 Network to another Network. The Issues which we face :- During transfer some times( Once in 1 week (or twice)) , the speed of transfer gets down to 30 kb/s,... (2 Replies)
Discussion started by: Upendra Bhushan
2 Replies

3. AIX

Rcp error while transferring files

i am trying to use a rsh script that uses the rcp command to copy files from server to server but it always produce the following error: HOSTNAME: protocol failure due to unexpected closure from server end Error: failed to copy /test to HOST2 system Error: failed to execute command on remote... (5 Replies)
Discussion started by: Portabello
5 Replies

4. Shell Programming and Scripting

Script for transferring files

Hi Guys, I have to transfer a few files in my system . The commands to be used are as follows . Will it be possible to send the output of the following in the form of a mail . cd /export/home/teja ls -lrt Quote.java* mv Quote.java Quote.java.20121023 cp /tmp/Quote.java . ls -lrt... (2 Replies)
Discussion started by: Ravi_Teja
2 Replies

5. UNIX for Dummies Questions & Answers

Transferring files from one linux server into another

Hello , I want to transfer files from one linux server into another , I got it working using SCP command , but I have to type in password for each and every file . All the remote severs have the same password , so is there a way that I can transfer all these files by typing my password only once ? (5 Replies)
Discussion started by: RaviTej
5 Replies

6. Shell Programming and Scripting

Deleting File from FTP and Transferring File to FTP

Hi, I am getting error when i am deleting file from FTP and also transferring file from local to FTP server. I am getting 221 error. I am getting this error some time only. Some time the existing file from FTP is deleted and file from local directory is transferred to FTP server. ... (2 Replies)
Discussion started by: praka
2 Replies

7. Shell Programming and Scripting

transferring files using ftp but mantaining the dates

Hi guys, Is there a way I can ftp some files without changing the last-modified dates from them ? I haven't seen any ftp option to do so. Or, alternatively, how do I change the last-modified date for a file, if this is possible... ? Thanks in advance, Abrahao. (4 Replies)
Discussion started by: 435 Gavea
4 Replies

8. UNIX for Dummies Questions & Answers

transferring files to and from remote computer

Hi all, i first have to ssh into my university account and then through there another ssh into my office computer, from my home computer. I have been trying to transfer files to and from with no such luck. How do i send a file from home to my office computer. Do I have to send it to my... (6 Replies)
Discussion started by: yogi1
6 Replies

9. Shell Programming and Scripting

FTP session expiring when transferring files... Need some solution

Hi All, I am running a ftp script which is running fine even with crontab. But the problem is that when I connect to ftp server and transfer files , i observe that ftp session expires after few minutes and the file transfer is not completed as there are alot of files to be transfered . ... (4 Replies)
Discussion started by: aarora_98
4 Replies

10. IP Networking

Transferring data to a windows environment using ftp

I need to transfer data from SCO Unix to a windows 2000 or 98 machine. The files are too big for doscp, and I can't get the right programs for transferring via kermit. So the next step, though perhaps more difficult, would be to set up an ethernet network and tranfer the data using ftp. I have... (3 Replies)
Discussion started by: ccs8217
3 Replies
Login or Register to Ask a Question