sw0o0sh Posted June 25, 2010 Share Posted June 25, 2010 Is there a way to do this simply in one line? For example, $sp="dir/"; $totalcontents = count(glob($sp . "*")); would return the amount of files AND directories combined in a specific directory. But how could I limit this to directories only? Quote Link to comment https://forums.phpfreaks.com/topic/205827-counting-the-amount-of-directories-in-a-directory/ Share on other sites More sharing options...
Psycho Posted June 25, 2010 Share Posted June 25, 2010 Try reading the manual. http://us3.php.net/manual/en/function.glob.php glob() accepts an optional secondary parameter. There is one specifically for what you want. Quote Link to comment https://forums.phpfreaks.com/topic/205827-counting-the-amount-of-directories-in-a-directory/#findComment-1077052 Share on other sites More sharing options...
sw0o0sh Posted June 25, 2010 Author Share Posted June 25, 2010 oooooh thanks a lot pooky Quote Link to comment https://forums.phpfreaks.com/topic/205827-counting-the-amount-of-directories-in-a-directory/#findComment-1077056 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.