in reply to Re: Capturing FTP output
in thread Capturing FTP output

Is this what you mean? Cannot get it too work
my $pid = open2(\*READ, \*WRITE, "ftp -i -v -n" ); print WRITE "open $FTP_HOST\n"; print WRITE "quote USER $FTP_USER\n"; print WRITE "quote PASS $FTP_PASS\n"; print WRITE "cd $FTP_DIR\n"; print WRITE "FTP "bin\n"; print WRITE "get $FTP_FILE\n"; print WRITE "bye\n"; my @data = <READ> ;

Replies are listed 'Best First'.
Re^3: Capturing FTP output
by starbolin (Hermit) on May 15, 2008 at 21:45 UTC

    Your script as posted contains won't compile as it contains syntax errors. Your big problem, however, is that ftp, when not in interactive mode, doesn't write to anything to stdout. You won't know if anything goes wrong. Ftp will just exit without saying anything. So you'll need to check your files to see if the transfer actually took place.

    Caveat: tested on FreeBSD.


    s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}