outlawstar223 Posted April 28, 2010 Share Posted April 28, 2010 How would I go about coding a php script that would give me that last 100 files in a folder? I need to read them to display some info Quote Link to comment Share on other sites More sharing options...
litebearer Posted April 29, 2010 Share Posted April 29, 2010 perhaps this may be a staring point http://www.nstoia.com/toh/listdir.php Quote Link to comment Share on other sites More sharing options...
outlawstar223 Posted April 29, 2010 Author Share Posted April 29, 2010 That is a good start, I understand what they are doing by putting the date in an array and then sorting the whole array. The reason I did not want to take that approach was because there could be thousands of files and I think that might be a performance problem. I was hoping of a more concise solution. Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted April 29, 2010 Share Posted April 29, 2010 Use the scandir function: http://www.php.net/scandir Quote Link to comment Share on other sites More sharing options...
litebearer Posted April 29, 2010 Share Posted April 29, 2010 is it feasible to put the file info in a database table? if so it would most likely be easier and faster to get the result you desire Quote Link to comment Share on other sites More sharing options...
outlawstar223 Posted April 29, 2010 Author Share Posted April 29, 2010 Unfortunately scandir will not work for my needs. Regarding the database, unfortunately it was not implemented that way although that is the way it should have been implemented. So it seems that the only way is going to have to put the name and date in arrays and sort it that way. Please if anyone has another option I would be vert thankful. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.