note 53665 deleted from function.rmdir by aidan
| From: | aidan@php.net | Date: | Wed, 15 Apr 2009 04:28:50 +0000 |
| Subject: | note 53665 deleted from function.rmdir by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153274@lists.php.net to get a copy of this message | ||
Note Submitter: m dot winkel at stonkel dot de
----
The example in the previous note will stop and return false, if there is an empty subdirectory. I
suggest to modify this snipplet of the previous example:
<?
$matching = glob($fileglob);
if ($matching === false) {
trigger_error(sprintf('No files match supplied glob %s', $fileglob),
E_USER_WARNING);
return false;
}
?>
Here is my version:
<?
$matching = glob($fileglob);
if ($matching === false) {
return true;
}
?>
If there are no matching files in the directory, there is no need to delete something or to trigger
an error. It just returns true and the (empty) directory will be deleted by the rmdir command.