<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Dir structure</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1255">
<META content="MSHTML 6.00.2712.300" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#e0e0e0>
<DIV><FONT face=Arial size=2>The shell command "tree" could help
you.</FONT></DIV>
<DIV><FONT face=Arial size=2>There's File::Find like Gabor pointed out, and my
very own MP3 file lister, which could be adapted for your need:</FONT></DIV>
<DIV><FONT face=Arial size=2>#!/bin/perl -w<BR>use CGI qw(:all);<BR>use
strict;<BR>print header;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>my $mp3dir="/home/nimster/music/"; #change this to
your filedir<BR>my @subs=&findfiles($mp3dir); </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>sub findfiles {<BR> my
($currdir)=@_;<BR> opendir(MP3ROOTDIR, $currdir);<BR> my
@allfiles=grep(!/^\.\.?$/, readdir MP3ROOTDIR);<BR>
closedir(MP3ROOTDIR);<BR> <BR> my @subdirs=grep(!/.*\..*/,
@allfiles);<BR> my @rootfiles=grep(/.*\.mp3/i, @allfiles); #change
extension to whatever you want...<BR> $currdir=~/^.*\\(music.*)$/; my
$pathdir=$1; #this just beautifies the output a bit<BR> print
"<h1>$1</h1>";</FONT></DIV><FONT face=Arial size=2>
<DIV><BR> foreach (@rootfiles) {<BR> my $file=substr($_,
0, -4); #cuts the .mp3 extension...<BR> print "<A
href=\"$pathdir\\$_\"> $file <\/a> <BR>"; #prints them as
links<BR> }<BR> print "<BR>";<BR> foreach (@subdirs)
{<BR> &findfiles("$currdir\\$_"); <BR> }<BR>
return @subdirs;<BR>}</DIV>
<DIV> </DIV>
<DIV>-Nimster</FONT></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=yaron.golan@SeabridgeNetworks.com
href="mailto:yaron.golan@SeabridgeNetworks.com">Yaron Golan</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=perl@perl.org.il
href="mailto:'perl@perl.org.il'">'perl@perl.org.il'</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, January 28, 2002 12:20
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Perl] Dir structure</DIV>
<DIV><BR></DIV>
<P><FONT face=Arial size=2>Hi all,</FONT> <BR><FONT face=Arial size=2>Do you
know (or have) where can I find a script that gets a root directory and prints
its directory structure under it?</FONT> </P>
<P><FONT face=Arial size=2>Thanks in advance,</FONT> <BR><FONT face=Arial
size=2>YG</FONT> </P></BLOCKQUOTE></BODY></HTML>