Hi !
The simplest method would be to use the
cwd method
to change the current directory to the one you want to do
an
ls in.
BTW: Answers here are generally posted here as a reply node, so that others can see if a question was answered already, correct answers or learn from them.
Update: Here is some code that might help you:
use strict;
use Net::FTP;
my $remote_host = "*****************";
my $remote_user = "*******";
my $remote_password = "*******";
my $remote_dir = "/tmp";
my $ftp = Net::FTP->new($remote_host) or die "error initiating ftp: $!
+\n";
$ftp->login($remote_user,$remote_password) or die "couldn't login: $!\
+n";
# force binary transmission of files, generally a good idea
$ftp->binary();
my @files = $ftp->ls($remote_dir);
print join "\n",@files;
print "\n","="x80,"\n";
# now change current working directory and do ls there
$ftp->cwd($remote_dir);
my @files = $ftp->ls();
print join "\n",@files;
----
amphiplex
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.