note 96535 deleted from function.rmdir by danbrown

From: Date: Wed, 03 Mar 2010 23:25:59 +0000
Subject: note 96535 deleted from function.rmdir by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-166638@lists.php.net to get a copy of this message
Note Submitter: ooypunk at hotmail dot com ---- The function mentioned below works better at my machine (Windows) like this: <?php 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 ); } ?> This is, I think, because in Windows directories don't end in '/', but in '\'.

« previous php.notes (#166638) next »