php4ever Posted October 22, 2007 Share Posted October 22, 2007 Anyone have a simple function or snippet that can count files in a remote folder? ~ Jared Quote Link to comment https://forums.phpfreaks.com/topic/74274-allow_url_fopen-question-2/ Share on other sites More sharing options...
JJohnsenDK Posted October 22, 2007 Share Posted October 22, 2007 try this out: <? $dir = '/path/to/directory/'; $filecount = 0; $d = dir($dir); while ($f = $d->read()) { if(($f!= ".") && ($f!= "..")) { if(!is_dir($f)) $filecount++; } } echo 'there are ',$filecount,' files in this folder'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/74274-allow_url_fopen-question-2/#findComment-375283 Share on other sites More sharing options...
enoyhs Posted October 22, 2007 Share Posted October 22, 2007 You can take a look at this: http://fijiwebdesign.com/content/view/83/77/ Quote Link to comment https://forums.phpfreaks.com/topic/74274-allow_url_fopen-question-2/#findComment-375288 Share on other sites More sharing options...
php4ever Posted October 22, 2007 Author Share Posted October 22, 2007 Both good examples, thank you. ~ Jared Quote Link to comment https://forums.phpfreaks.com/topic/74274-allow_url_fopen-question-2/#findComment-375552 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.