Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP error handling

Status
Not open for further replies.

sappleg

Programmer
Apr 15, 2008
31
CA
Hi Guys,

I am using the following ftp script in my Perl program. However, I want to track if the file has been successfully transfered or not. Is there any way to do this. I have browsed the net and this site exhaustively, but couldn't find any tips on this. Here's my small ftp script within perl:

open(FTP_PIPE,"|ftp -n -i 11.11.111.11");
print FTP_PIPE <<EOF;
user abcd efghijk
cd /dir1/dir2
binary
! dir
mput test*.txt
dir
EOF
close(FTP_PIPE);


Thanks for all your help/tips. Much appreciated.
 

afaik this is a core Perl module that you should probably already have installed, so use that instead... no sense reinventing the wheel. The method you're going about it (opening a pipe) makes it very difficult for the pipe to work in both directions. Net::FTP uses sockets directly so there's two-way communication.

Cuvou.com | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
Thanks Guys, I will have a look at Net::FTP module.

Thanks 'Cuvou.com' for your code. I am going to try this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top