Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Directory Tree Structure

by rupesh (Hermit)
on Oct 21, 2005 at 10:10 UTC ( #501944=note: print w/ replies, xml ) Need Help??


in reply to Re: Directory Tree Structure
in thread Directory Tree Structure


Thanks marto,
I've had a look at the module and also File::Find::Recurse.
The issue is, how do I structure the directories in the form of a tree?

Here's what I need to identify:
The main directory (done)
All the subdirectories for the main directory (done)
Each subdirectory's subdirectories (confusing, but doable)
..recuresively (uh..uh)
and then, put it all in one data structure, wherein I can identify specific points where I can start and end the  <li> and the <ul> tags.


Thanks,
Rupesh.


Comment on Re^2: Directory Tree Structure
Download Code
Re^3: Directory Tree Structure
by blazar (Canon) on Oct 21, 2005 at 10:38 UTC
    I've always stuck with File::Find and never really got involved into its fancy variants. I think you can print some opening tags as a preprocess action and some closing one at postprocess time. Check the documentation: there may be alternative ways, but this should be easy enough to be left as an exercise to the reader...
Re^3: Directory Tree Structure
by marto (Bishop) on Oct 21, 2005 at 10:42 UTC
    Hi rupesh,

    "Each subdirectory's subdirectories (confusing, but doable)
    ..recuresively (uh..uh)"

    Are you having difficulty doing this recursively?
    As a little example look at this code below:
    #!/usr/bin/perl use strict; use warnings; use File::Find; my $TargetPath = $ARGV[0]; find (\&ProcessTree,$TargetPath); sub ProcessTree { print "Directory: $File::Find::name\n" if -d; print "File: $File::Find::name\n" unless -d; }

    Call this script with the path you want to traverse as an argument.
    Are you planning on using the HTML::Template module?
    I hope the above example has given you an idea of how to tackle this.
    Let me know how you get on.

    Martin

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://501944]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (14)
As of 2015-07-03 13:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (53 votes), past polls