note 96897 deleted from function.rmdir by danbrown
| From: | danbrown@php.net | Date: | Wed, 15 Sep 2010 21:23:54 +0000 |
| Subject: | note 96897 deleted from function.rmdir by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172611@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Little addition to Kevins's function, since directories under Windows can end with backslash as
well!
function delTree($dir) {
$files = glob( $dir . '*', GLOB_MARK );
foreach( $files as $file ){
if( is_dir( $file ) )
delTree( $file );
else
unlink( $file );
}
if (is_dir($dir)) rmdir( $dir );
}