in reply to Re^3: perl ftp
in thread perl ftp

Hi Dear, i tried the options that you mentioned but i didnt get what i want.Any other possible way ? Please help this is what i am getting on the STDOUT ====================================================== Net::FTP=GLOB(0x4024198c)<<< 220 nti261 FTP server (Version 1.1.214.4(PHNE_30990) Mon Nov 2:47:12 GMT 2004) ready. Net::FTP=GLOB(0x4024198c)>>> user veerams Net::FTP=GLOB(0x4024198c)<<< 331 Password required for veerams. Net::FTP=GLOB(0x4024198c)>>> PASS .... Net::FTP=GLOB(0x4024198c)<<< 230 User veerams logged in. User veerams logged in. |230 Net::FTP=GLOB(0x4024198c)>>> CWD ~/working Net::FTP=GLOB(0x4024198c)<<< 250 CWD command successful. CWD command successful. |250 Net::FTP=GLOB(0x4024198c)>>> PORT 10,201,15,62,228,180 Net::FTP=GLOB(0x4024198c)<<< 200 PORT command successful. Net::FTP=GLOB(0x4024198c)>>> STOR 1 Net::FTP=GLOB(0x4024198c)<<< 150 Opening ASCII mode data connection for 1. Net::FTP=GLOB(0x4024198c)<<< 226 Transfer complete. . .. 1 2 a b c d f s zOpening ASCII mode data connection for 1. Transfer complete. |226 ===================================== and this is what is being put in the logfile ================================================ User veerams logged in. |230 CWD command successful. |250 Opening ASCII mode data connection for 1. Transfer complete. |226 /home/veerams/source/1 Opening ASCII mode data connection for 2. Transfer complete. |226 /home/veerams/source/2 Opening ASCII mode data connection for a. Transfer complete. |226 ======================================= i want the whole output that i am getting on the STDOUT into the logfile and not the one that i am getting now Any way out ? please help Thanks in advance Veera

Replies are listed 'Best First'.
Re^5: perl ftp
by derby (Abbot) on May 20, 2005 at 19:28 UTC
    srini_veera, what platform are you running this under? Windows? Linux? Solaris? HP-UX? And more specifically what shell? sh? csh? bash? ksh? The output should be going to STDERR not STDOUT. It's the shell syntax that you need to properly construct (and thats different for each shell) and we cannot help unless you tell us what shell you're running under.

    If you don't want to be bothered with shell syntax, just close STDERR and re-open it to your log:

    !/usr/bin/perl -w use strict; use Net::FTP; # Capture STDERR close( STDERR ); open( STDERR, ">mylog.txt" ); my $ftp = Net::FTP->new("some.host.name", Debug => 1) or die "Cannot connect to some.host.name: $@"; $ftp->login("ftp",'foo@bar.com') or die "Cannot login ", $ftp->message; $ftp->cwd("/") or die "Cannot change working directory ", $ftp->message; $ftp->get("filename") or die "get failed ", $ftp->message; $ftp->quit;

    -derby