note 48116 added to function.is-dir

From: Date: Sun, 12 Dec 2004 16:19:00 +0000
Subject: note 48116 added to function.is-dir
Groups: php.notes 
Request: Send a blank email to php-notes+get-81723@lists.php.net to get a copy of this message
This is the function that I use to test for an empty directory: <?php function is_emtpy_dir($dirname){ // Returns true if $dirname is a directory and it is empty $result=false; // Assume it is not a directory if(is_dir($dirname) ){ $result=true; // It is a directory $handle = opendir($dirname); while( ( $name = readdir($handle)) !== false){ if ($name!= "." && $name !=".."){ $result=false; // directory not empty break; // no need to test more } } closedir($handle); } return $result; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.is-dir.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48116 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48116&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48116&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48116&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48116&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48116&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48116&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48116&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#81723) next »