Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

How to display the contents of a directory

Options
  • 21-05-2003 9:45am
    #1
    Closed Accounts Posts: 2,120 ✭✭✭


    Got a problem I want to solve.

    I got quite a lot of HTM files I want to archive but to remain accessable via the web. So what I want to do is dump these files into a directory and display the contents of this directory as links in a frame.

    How do I do this?


Comments

  • Closed Accounts Posts: 2,120 ✭✭✭PH01


    I'm not sure if a file manager will do it for me. The things I'm trying to do is a 'Table of Contents' type of thing. Though a file manager type app does kinda do some thing like it.


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    You need to tell us what technologies you have available on the server, if any. In PHP, you'd use the directory functions or dir() pseudo-class. If server-side stuff isn't available, why not just use standard directory listings?

    adam


  • Registered Users Posts: 55,519 ✭✭✭✭Mr E


    Have a good look through those links. Some of the apps are for directory listings only....

    All source code is available too, so anything there can be modified (e.g. buttons removed etc.)

    - Dave.


  • Closed Accounts Posts: 2,120 ✭✭✭PH01


    Originally posted by dahamsta
    You need to tell us what technologies you have available on the server, if any. In PHP, you'd use the directory functions or dir() pseudo-class. If server-side stuff isn't available, why not just use standard directory listings?

    adam

    The web site I manage (or attempt to manage) has perl, so I've been looking through http://www.cgi-resources.com for help but nothing seems to jump out at me that will provide the solution.
    I also got SSI enabled recently which I'm using for News Publisher (http://www.gwscripts.com/).

    But my concern is the whole raft of previously published 'News' documents currently on the site which are getting harder and harder to maintain. I've gotta come up with a simple solution to take care of these 'legacy' htm files. So I thought I'd just dump them into a directory, create a frameset with two frames, list the contents of the directory on the left with links, that when clicked will display on the right - sounds simple doesn't it?


  • Advertisement
  • Closed Accounts Posts: 2,120 ✭✭✭PH01


    Originally posted by TmB
    Have a good look through those links. Some of the apps are for directory listings only....

    All source code is available too, so anything there can be modified (e.g. buttons removed etc.)

    - Dave.

    Having a scan through http://www.cgi-resources.com/Programs_and_Scripts/Perl/File_Management/ and http://www.hotscripts.com/Perl/Scripts_and_Programs/File_Manipulation/File_Management/
    at the moment - will get back if I come up trumps.


  • Closed Accounts Posts: 2,120 ✭✭✭PH01


    I've been having no joy with this. My original thinking on this won't work. It would be good enough just to display a list of files especially when the info contained within needs to be categorised and chronically ordered.

    So I'm currently looking for a database that stores the information with UI.
    Does anyone know what I can use to do this?


  • Closed Accounts Posts: 1,414 ✭✭✭tom-thebox


    Many hosts do not allow directory browseing these days due to the amount of traversal bug's.

    So you will more than likly need a script.


    <?

    $dh = opendir(".");

    while ( gettype( $file = readdir( $dh ) ) != boolean ) {

    if ($file != "." && $file != "..") { echo "<a href=$file>$file</a><br>\n"; }

    }

    closedir($dh);

    ?>



    To use the script just put it into a file called index.php in the directory that you want to display the content of.


  • Closed Accounts Posts: 2,120 ✭✭✭PH01


    Originally posted by tom-thebox
    <?

    $dh = opendir(".");

    while ( gettype( $file = readdir( $dh ) ) != boolean ) {

    if ($file != "." && $file != "..") { echo "<a href=$file>$file</a><br>\n"; }

    }

    closedir($dh);

    ?>

    Cheers Tom that worked. I'm not great scripts so any help is very much appreciated.


  • Closed Accounts Posts: 1,414 ✭✭✭tom-thebox


    Originally posted by PH01
    Cheers Tom that worked. I'm not great scripts so any help is very much appreciated.

    Not a bother glad to help. :)


  • Advertisement
  • Registered Users Posts: 7,739 ✭✭✭mneylon


    Another script that will give you a nicer output - ie. it will use the document title - is http://www.danielnaber.de/tree/


  • Closed Accounts Posts: 1,414 ✭✭✭tom-thebox


    Originally posted by blacknight
    Another script that will give you a nicer output - ie. it will use the document title - is http://www.danielnaber.de/tree/

    Looks pretty alright. Perl is a friend of mine I like it.


  • Closed Accounts Posts: 2,120 ✭✭✭PH01


    Originally posted by tom-thebox
    Looks pretty alright. Perl is a friend of mine I like it.

    See where it displays the 'title' tag, could the script be changed to display the 'description' tag?

    Out couldn't it display any tag you specify. like the ones you might create yourself?


  • Registered Users Posts: 7,739 ✭✭✭mneylon


    You'd have to play with the code to change the display options.


  • Closed Accounts Posts: 2,120 ✭✭✭PH01


    Originally posted by blacknight
    You'd have to play with the code to change the display options.
    I'll give it a go. Besides, what's the worst that could happen?


  • Registered Users Posts: 7,739 ✭✭✭mneylon


    Originally posted by PH01
    I'll give it a go. Besides, what's the worst that could happen?
    em....
    dunno really...


Advertisement