Last active
January 7, 2016 14:55
-
-
Save Bat-Chat/dbead0b3692e2505fcd6 to your computer and use it in GitHub Desktop.
Get count of files in directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dir = new DirectoryIterator('/directoryPath/'); | |
$count = 0; | |
foreach($dir as $file) { | |
$count += ($file->isFile()) ? 1 : 0; | |
} | |
print_r($count); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment