note 64574 deleted from function.is-writable by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 14:58:14 +0000 |
| Subject: | note 64574 deleted from function.is-writable by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197252@lists.php.net to get a copy of this message | ||
Note Submitter: Nils Kuebler
----
this one recursivly checks if a folder and all its contents are writeable
<?php
function is_removeable($dir)
{
$folder = opendir($dir);
while($file = readdir( $folder ))
if($file != '.' && $file != '..' &&
( !is_writable( $dir."/".$file ) ||
( is_dir( $dir."/".$file ) && !is_removeable( $dir."/".$file
) ) ))
{
closedir($dir);
return false;
}
closedir($dir);
return true;
}
?>