note 28285 added to function.is-dir
| From: | heda at hotpop dot com | Date: | Wed, 08 Jan 2003 13:46:31 +0000 |
| Subject: | note 28285 added to function.is-dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41824@lists.php.net to get a copy of this message | ||
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;
}
--
http://www.php.net/manual/en/function.is-dir.php
http://master.php.net/manage/user-notes.php?action=edit+28285
http://master.php.net/manage/user-notes.php?action=delete+28285
http://master.php.net/manage/user-notes.php?action=reject+28285