AV1611 Posted March 16, 2009 Share Posted March 16, 2009 How can I count the number of .jpg files (exact extension, not .jpeg for example) in the current directory (i.e. the directory in which the php script is located)? Thanks. Link to comment https://forums.phpfreaks.com/topic/149717-count-files/ Share on other sites More sharing options...
Zhadus Posted March 16, 2009 Share Posted March 16, 2009 Use scandir() and check the .jpg in the filename from the array it retrieves. Link to comment https://forums.phpfreaks.com/topic/149717-count-files/#findComment-786183 Share on other sites More sharing options...
trq Posted March 16, 2009 Share Posted March 16, 2009 echo count(glob("*.jpg")); Link to comment https://forums.phpfreaks.com/topic/149717-count-files/#findComment-786185 Share on other sites More sharing options...
AV1611 Posted March 16, 2009 Author Share Posted March 16, 2009 I was trying to figure how to do what Zhadus suggested but couldn't figure it out, but Thorpe, your answer is much better in this case, As always, you are my hero Thorpe! Link to comment https://forums.phpfreaks.com/topic/149717-count-files/#findComment-786194 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.