tja_ariani has asked for the wisdom of the Perl Monks concerning the following question:
but it gave me this :require "ftp.pl"; $ftpHost = "x.x.x.x"; if (&ftp::open($ftpHost,21,0,1) != 1) { die "Can't open $ftpHost\n"; } if (&ftp::login("name","pwd") != 1) { die "Can't login to $ftpHost\n"; } if (($pwd = &ftp::pwd) eq "") { die "Can't get current directory\n"; } print "pwd = $pwd\n"; $newCwd = "/perl"; if (&ftp::cwd($newCwd) != 1) { die "Can't cwd to $newCwd \n"; } if (&ftp::dir_open !=1 ) { die "Can't open directory for reading\n"; } print "Directory listing for $newCwd:\n"; while (&ftp::read() > 0) { print $ftp::buf; } if (&ftp::dir_close != 1) { die "can't close directory read\n"; } $file = "x.pm"; print "Getting $file \n"; #if (&ftp::get($file,"NewName") != 1) if (&ftp::get($file) != 1) { die "Can't get $file\n"; } &ftp::close;
Edit: Added <code> tags, larsen
edited by ybiC: retitle from "tcp cnx"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: ftp.pl to retrieve a file
by esh (Pilgrim) on Aug 15, 2003 at 11:59 UTC | |
|
Re: ftp.pl to retrieve a file
by liz (Monsignor) on Aug 15, 2003 at 10:15 UTC |