protected isEmptyDirectory ( string $dir ) : boolean | ||
$dir | string | the path of the directory to check |
리턴 | boolean | Whether the given directory is empty |
protected function isEmptyDirectory($dir)
{
// glob() cannot be used because it doesn't take into account hidden files
// scandir() returns '.' and '..' for an empty dir
return 2 === count(scandir($dir . '/'));
}