(A copy of this message has also been posted to the following newsgroups:
comp.lang.perl.misc)
Hi all,
I'm having some trouble understanding how to get a "remote directory
listing" using the "ftp.pl" package off CPAN.
Using the "Basic usage" section at the top of the "ftp.pl" package, I can
connect, identify, change to binary mode & get a file. I can't work out
how to get a directory listing however. It looks like there should be a
routine called ftp'dir(), but it's not implemented. There are the routines
ftp'dir_open() and ftp'dir_close() but these look like low level private
internal calls to me.
Any suggestions??
Here's my code:
#!/usr/local/bin/perl
unshift(@INC,".");
require "ftp.pl";
if (&ftp'open("machine.domain",21,1,2) != 1)
{
die "failed to open ftp connection";
}
if (!&ftp'login("user","passwd"))
{
die "failed to login";
}
&ftp'type("I");
&ftp'cwd("/");
&ftp'dir(""); #???????????????????????????????????????
if(!&ftp'get("file.txt","",0))
{
die "failed to get file";
}
&ftp'quit();
exit(0);
Thanks In Advance,
Chris B
-----------------------------------------------------------------------
NewZealand:AucklandUniversity:ComputerScience:HyperMediaUnit:ChrisBurns
Internet: chris-b@cs.auckland.ac.nz
Phone: +64 9 373-7599 x5602
Fax: +64 9 373-7453 Async, Therefore I Am.
-----------------------------------------------------------------------
comp.lang.perl.misc)
Hi all,
I'm having some trouble understanding how to get a "remote directory
listing" using the "ftp.pl" package off CPAN.
Using the "Basic usage" section at the top of the "ftp.pl" package, I can
connect, identify, change to binary mode & get a file. I can't work out
how to get a directory listing however. It looks like there should be a
routine called ftp'dir(), but it's not implemented. There are the routines
ftp'dir_open() and ftp'dir_close() but these look like low level private
internal calls to me.
Any suggestions??
Here's my code:
#!/usr/local/bin/perl
unshift(@INC,".");
require "ftp.pl";
if (&ftp'open("machine.domain",21,1,2) != 1)
{
die "failed to open ftp connection";
}
if (!&ftp'login("user","passwd"))
{
die "failed to login";
}
&ftp'type("I");
&ftp'cwd("/");
&ftp'dir(""); #???????????????????????????????????????
if(!&ftp'get("file.txt","",0))
{
die "failed to get file";
}
&ftp'quit();
exit(0);
Thanks In Advance,
Chris B
-----------------------------------------------------------------------
NewZealand:AucklandUniversity:ComputerScience:HyperMediaUnit:ChrisBurns
Internet: chris-b@cs.auckland.ac.nz
Phone: +64 9 373-7599 x5602
Fax: +64 9 373-7453 Async, Therefore I Am.
-----------------------------------------------------------------------