- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- can not get perl Net:FTP remote file listing to w...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2007 08:11 AM
10-09-2007 08:11 AM
I want a simple list of files (ls -1). I don't want a long listing "ls -l" command.
1 (aka ONE) is different from l (aka L).
I can't seem to get any output from nlist in the perl module.
my $ftp = Net::FTP->new($hostname) || die "cant connect to host" ;
$ftp->binary();
$ftp->login($username,$password) || die "cant login to host";
print $ftp->cwd($DIR);
foreach ( $ftp->nlst ) {
print $_;
}
Instead of a list from this $ftp->nlst, I get a binary memory address. I know the answer should be simple. But I can't find it.
PS: In the event this is posted twice....sorry. My internet access blew up about 15 minutes ago. I just got it back.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2007 09:45 AM
10-09-2007 09:45 AM
Solutionuse constant GOOD_BOY => 2;
my $stat = 0;
my $ftp = Net::FTP->new($hostname) || die "cant connect to host" ;
$ftp->binary();
$ftp->login($username,$password) || die "cant login to host";
$ftp->cwd($DIR);
my @a = $ftp->ls();
$stat = $ftp->status;
if ($stat == GOOD_BOY)
{
my $i = 0;
while ($i <= $#a)
{
printf ("%s\n",$a[$i]);
++$i;
}
}
else
{
printf STDERR ("ls failed. status %d\n",
$stat);
}
$ftp->quit;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2007 10:01 AM
10-09-2007 10:01 AM
Re: can not get perl Net:FTP remote file listing to work
Using:
...
foreach ($ftp->ls) {
...
returns the list of filenames without additional information.
You can use 'for' as a shortened notation in lieu of 'foreach', too.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2007 12:17 AM
10-10-2007 12:17 AM
Re: can not get perl Net:FTP remote file listing to work
Unfortunately everytime I try to "submit points" the website comes back with "service unavailable."
Hopefully this message will provide some sort of anti-jinx to that button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2007 12:19 AM
10-10-2007 12:19 AM