We help IT Professionals succeed at work.
Get Started

PHP Directory List Group and Sort

onetoomany asked
Last Modified: 2012-05-09
There are many solutions on the web for PHP directory listing howwver the ones I found either didn't have all the functions or I couldn't make all the functions work together. would appreciate help with the following for a beginner:

Relative path = 'files/'

Get all directories and files under this path and output in unordered list as follows:

 - Directory Name (sort ascending)
   -  "Date Group" by File Created Date Descending.
      -  <a href="path/filename">File name</a>  | File Size | Created Date (sort descending: m/d/Y H:i:s)

so an example output might look something like this:

 * Folder-A
       + Files created on 02/03/2010
            > file01212.txt | 352 kb | 02/03/2010 17:30:01
            > file01112.txt | 352 kb | 02/03/2010 17:30:00
       + Files created on 02/02/2010
            > file08212.txt | 152 kb | 02/02/2010 10:30:25
            > file01118.txt | 302 kb | 02/02/2010 07:30:24
 * Folder-B
       + Files created on 03/07/2010
            > file0121.txt | 1352 kb | 03/07/2010 09:00:01
            > file0000.txt | 6352 kb | 03/07/2010 08:30:00

Thanks in advance.


Watch Question
This problem has been solved!
Unlock 1 Answer and 12 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE