davefootball123 Posted September 11, 2013 Share Posted September 11, 2013 Hello all, this issue really has me stumped. I'm actually a bit unsure of where to start. There are a bunch of files in a directory shown here. http://dd.weatheroffice.ec.gc.ca/bulletins/alphanumeric/20130911/WU/CWTO/00/ What I need to do is get the latest WUCN12 bulletin from the directory. As you can see they have a creation date, however I am unsure of how to grab the latest one of the WUCN12 bulletin. Any help would be great, Quote Link to comment https://forums.phpfreaks.com/topic/282062-get-latest-file-from-directory/ Share on other sites More sharing options...
requinix Posted September 11, 2013 Share Posted September 11, 2013 (edited) It seems like the most reliable indicator is not the creation time but the filename suffix. '/(?Pass that string to preg_match_all, sort the [0] matches in reverse order, and grab the first one. Edited September 11, 2013 by requinix Quote Link to comment https://forums.phpfreaks.com/topic/282062-get-latest-file-from-directory/#findComment-1449068 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.