<?php
if ($handle = opendir('files')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
if (is_dir("files/".$entry)) {
$_count = count(glob("files/".$entry."/*"));
if ($_count == 0) {
unlink("files/".$entry);
}
}
}
}
closedir($handle);
}
?>
Open in new window
Or you can rewrite all find's logic (shudder)...
Best to use existing + working tools, when they exist.