Bat-Chat
1/7/2016 - 2:53 PM

Get count of files in directory

Get count of files in directory

<?php
    $dir = new DirectoryIterator('/directoryPath/');
    $count = 0;
    foreach($dir as $file) {
        $count += ($file->isFile()) ? 1 : 0;
    }
    
    print_r($count);