quagmire02 All American 44225 Posts user info edit post |
before folks here started publishing a lot of content as pages, they produced PDFs, word documents, etc and as a result, we have a boatload of archived files on the web that probably no one ever looks at
most are in folders, sorted by date...so the structure is like: [root] file1.pdf file2.doc file3.xlsx 20130101 - file4.pdf - file5.doc - file6.xlsx 20130102 - file7.pdf - file8.doc - file9.xlsx all i want to do is create a series of unordered lists that link to the files, titled by the date of the folder in descending order (most recent date is first), the files in the folder sorted alphabetically, and those files in the root in their own category...something like: 20130102 - link to file7.pdf - link to file8.doc - link to file9.xlsx 20130101 - link to file4.pdf - link to file5.doc - link to file6.xlsx unsorted files in the root - link to file1.pdf - link to file2.doc - link to file3.xlsx i figured the easiest thing to do is do a recursive directory read and store it as an array:$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::SELF_FIRST); but now i have to play with the array and i can't (quickly) think of a way to keep me from wasting a lot of time on this
anyone have a function that already does this? or am i missing something extremely obvious? am i making out the array sorting to be more tedious than it is?5/16/2013 1:35:44 PM |
moron All American 34142 Posts user info edit post |
How does recursiveiteratoriterator store directories?
Seems like it would be easier to have an array of array lists with the array lists storing the files in the directory, and the array being keyed by directory.
Then you just sort the array, then spit out the array lists sorted. 5/16/2013 8:25:55 PM |