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 Link to comment https://forums.phpfreaks.com/topic/200099-last-100-files/ 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 Link to comment https://forums.phpfreaks.com/topic/200099-last-100-files/#findComment-1050222 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. Link to comment https://forums.phpfreaks.com/topic/200099-last-100-files/#findComment-1050230 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 Link to comment https://forums.phpfreaks.com/topic/200099-last-100-files/#findComment-1050253 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 Link to comment https://forums.phpfreaks.com/topic/200099-last-100-files/#findComment-1050256 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. Link to comment https://forums.phpfreaks.com/topic/200099-last-100-files/#findComment-1050272 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.