Jump to content

Recursively display directory help


JD*

Recommended Posts

Hey everyone,

 

I'm trying to write a piece of code that will allow me to recursively look through a directory and list contents. I've tried a bunch of pre-made scripts but nothing is working correctly so far and I'm spent trying to figure it out.

 

What we have is a list of students that a teacher can click on an individual student, and then see different documents that have been uploaded from previous years. On the file system, they're stored in a path like:

/srv/www/website.com/files/student_number/2008-2009/language_arts/entry1.pdf

/srv/www/website.com/files/student_number/2008-2009/language_arts/entry2.pdf

 

What I'm looking to have is each directory from the year on down as an <h3> which I can then use some jquery to either make an accordion or some other effect, so the teachers can drill down. I was able to get the year to work, but everything below, not so much, as the looping wasn't being very flexible.

 

Also, when putting all of this into an array, it would list entry2 first, then entry1. I want to sort the array, but since it's all contained in one giant array, sorting just screws it all up.

 

Thanks for any help!

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.