in reply to Recursion Over FTP

Well not to do it all for you but try something like this, it makes a webpage that shows the contents of a FTP site with links that work:
#! /usr/bin/perl -w use strict; use Net::FTP; my $ftp = Net::FTP->new("Address to ftp site); print "Content-type: text/html\n\n"; print "<html><title>FTP Contents</title>"; print "<body bgcolor=black text=white link=lime vlink=wheat>"; if($ftp->login("Username", 'password')){ lister(0,"ftp://toplevel/"); } else{ print "FTP: Failed to login"; } $ftp->quit; print "</body></html>"; #----subs---- sub lister{ my $lev = shift; my $path = shift; my @dirs; my @files; my @dirarray = $ftp->ls(); foreach my $item(@dirarray){ if($ftp->cwd($item)){ $ftp->cdup(); push @dirs,$item; } else{ push @files,$item; } } my $buff="&nbsp&nbsp&nbsp&nbsp&nbsp" x $lev; foreach my $dirs(@dirs){ print "<font color=yellow>$buff\|_ $dirs</font><br>"; $ftp->cwd($dirs); lister($lev+1,$path."/".$dirs); } foreach my $file(@files){ print "<font color=lime>$buff\|_ <a href=\"$path/$file +\">$file</a></font><br>"; } $ftp->cdup(); }

Try looking at this seeing what I am doing. Basically, it checks the dir of a directory, splits the objects into directories and files, and recurses into the directories. Hope it helps.
Anyway, no drug, not even alcohol, causes the fundamental ills of society. If we're looking for the source of our troubles, we shouldn't test people for drugs, we should test them for stupidity, ignorance, greed and love of power.

--P. J. O'Rourke

Replies are listed 'Best First'.
Re: Re: Recursion Over FTP
by jmaya (Acolyte) on Oct 03, 2002 at 22:27 UTC
    Awesome This is exactly what i wanted... I learned alot thankz