note 78687 deleted from function.rmdir by aidan

From: Date: Wed, 15 Apr 2009 04:22:45 +0000
Subject: note 78687 deleted from function.rmdir by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153245@lists.php.net to get a copy of this message
Note Submitter: Cheetah Designs ---- None of the below functions worked for me, so I created this function to delete a folder, deleting anything in it first: function RecursiveFolderDelete ( $folderPath ) { if ( is_dir ( $folderPath ) ) { foreach ( scandir ( $folderPath ) as $value ) { if ( $value != "." && $value != ".." ) { $value = $folderPath . "/" . $value; if ( is_dir ( $value ) ) { FolderDelete ( $value ); } elseif ( is_file ( $value ) ) { @unlink ( $value ); } } } return rmdir ( $folderPath ); } else { return FALSE; } }

« previous php.notes (#153245) next »