Welcome to Microsoft where error checking is always optional. No, you aren't checking wrong - FTP always returns "0".
Like others, I strongly recommend using the Net::FTP module - it is fantastic. If you must use the ftp program, the trick is to put ftp in verbose mode (a command line option - don't know which at the moment) and redirect ftp's output to a file. Then, after the ftp, you look for lines in the output file that start with "5". Any line beginning with "5" would signify an error. Verify with testing of course. It's been a few years since I've done this, so the details are fuzzy. -----Original Message----- From: Glenn Meyer [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 09, 2002 8:19 AM To: Wheldon,M Cc: '[EMAIL PROTECTED]' Subject: RE: System("ftp This made a lot of sense, but I am finding the system() is returning "0" all the time: $sys = system("ftp -n $_[0] < ftp_commands.txt"); if successful connecting and performing commands - returns "0" if login to ftp server fails - still returns "0" if I put in a bad ip and the connection is refused - still returns "0" Am I possibly checking this value incorrectly? Glenn Meyer t/l 631-9100 - [EMAIL PROTECTED] Content Hosting Systems Administrator Service Delivery Center - South "Wheldon,M" <wheldom01@leedsle To: Glenn Meyer/Tampa/IBM@IBMUS arning.net> cc: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> 04/09/2002 02:29 Subject: RE: System("ftp AM You will find that the system call will return an integer depending on success or failure I believe. Try somthing like this if (system("ftp -n $_[0] < ftp_commands.txt") == 0) You would have to check the return values though. Hope this helps Martin Wheldon Senior Technical Consultant Leeds Learning Network Tel: 0113-214-4441 E-mail: [EMAIL PROTECTED] The information in this email (and any attachments) may be for the intended recipient only.If you know you are not the intended recipient, please do not use or disclose the information in any way and please delete this email ( and any attachment) from your system. -----Original Message----- From: Glenn Meyer [mailto:[EMAIL PROTECTED]] Sent: 08 April 2002 19:31 To: [EMAIL PROTECTED] Subject: System("ftp I am using the following subroutine to ftp log files to a central log server. my $ftphost = "10.xx.xx.xxx"; my $ftpuser = "weblog"; my $ftppasswd = "weblog"; &ftpzips($ftphost,$ftpuser,$ftppasswd); sub ftpzips { open(FTPCOMMANDS, ">ftp_commands.txt"); print FTPCOMMANDS "user $_[1] $_[2]\nbin\nprompt\nmput *.zip\nbye\n"; close(FTPCOMMANDS); system("ftp -n $_[0] < ftp_commands.txt"); } This is working well right now, but I need to add in some error checking and/or retry feature. Problem, I cannot add other packages to these boxes - I must use built in Perl functions and operators. These are NT4 servers with ActiveState Perl 5.6.0. Any thoughts as to how I can get either confirmation that the FTP was successful or that it failed? Thank you!! Glenn Meyer _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs