note 28285 deleted from function.is-dir by sniper
| From: | sniper@php.net | Date: | Mon, 13 Oct 2003 00:35:10 +0000 |
| Subject: | note 28285 deleted from function.is-dir by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58448@lists.php.net to get a copy of this message | ||
Note Submitter: heda@hotpop.com
----
here is a function that returns true if the dir is empty or if the dir only contains subdirs.
function is_emptydir($which){
$dh=dir($which);
$emptydir=true;
while ($file=$dh->read()) {
if(substr($file,0,1)==".") continue;
if(!is_dir($which."/".$file)) {
$emptydir=false;
break;
}
}
$dh->close();
return $emptydir;
}