The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script for FTPing files to mainframe GDG dsrookie UNIX for Dummies Questions & Answers 1 03-13-2008 06:32 AM
removing old files except configuration files and folders jamcalicut Shell Programming and Scripting 1 11-09-2007 01:34 PM
removing files luft UNIX for Dummies Questions & Answers 8 03-21-2007 09:53 AM
FTPing backup files to another server fredlucas3 UNIX for Dummies Questions & Answers 10 11-12-2002 08:40 AM
Removing Files Blondie UNIX for Dummies Questions & Answers 5 07-17-2001 03:30 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-30-2008
Registered User
 

Join Date: Nov 2007
Posts: 15
removing files after ftping

Hi All,

I'm trying to write script to ftp some files and then need to remove these files from server.
Is there any way to keep the condition that the file should be removed only after successfully transfered to the destinatino server?
If in case, the file isn't been transferd, it should not be removed.

Thanks in advance.

Regards,
im_new
Reply With Quote
Forum Sponsor
  #2  
Old 02-25-2008
Registered User
 

Join Date: Nov 2007
Posts: 15
Can anyone plz help/advise?
Reply With Quote
  #3  
Old 02-25-2008
Registered User
 

Join Date: Feb 2008
Posts: 91
did you try to check the status of transfer using '$?' ?
Reply With Quote
  #4  
Old 02-25-2008
Registered User
 

Join Date: Nov 2007
Posts: 15
Hi manikantants,
I'm dealing with ftp for the first time. I'm not sure how this status check is done? Can u plz let me know.. Even, I'll try to search for it.
Thanks
Reply With Quote
  #5  
Old 02-25-2008
Registered User
 

Join Date: Feb 2008
Posts: 91
'$?' will give the exit status of previous command.
So in case of ftp also you can check this exit status. If it is not equal to zero, that means ftp was not successfull.

following lines may help you. I haven't tested this.
Please test it properly before using.

ftp -n 255.255.255.255 << EOF
user username
password
put filename
bye
EOF

if [ $? -eq 0 ]
then
#do the required on successfull transfer
else
#do the required on failure
fi
Reply With Quote
  #6  
Old 02-25-2008
Registered User
 

Join Date: Nov 2007
Posts: 15
Thanks a ton!!!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0