Forum Moderators: coopster

Message Too Old, No Replies

last 10 files updated on site

         

roshaoar

12:17 pm on Mar 1, 2014 (gmt 0)

10+ Year Member



Hello,

Can anyone show me or point me towards a way to add a little box on my homepage that would show me the last 10 files updated (based on the save date of the file)

The bit of research I've done would indicate something with filemtime, but I need to access file save dates in 150 directories and I'm not sure how to do this

Thank you!

rainborick

4:45 pm on Mar 1, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You should be able to Google up dozens of example scripts that will list files by filemtime. But retrieving this information across 150 directories every time your home page is accessed is going to be slow and a strain on your server.

This is a job for a database.

roshaoar

6:32 pm on Mar 1, 2014 (gmt 0)

10+ Year Member



Yes, that's what I've done - thanks

4serendipity

2:45 am on Mar 6, 2014 (gmt 0)

10+ Year Member



You could always run something like the following hourly

find . -type f -printf '%T@ %p\n' | sort -k 1 -n | sed 's/^[^ ]* \.\(.*\)/ <a href="\1">\1<\/a>/' | tail -10