Return to Snippet

Revision: 23252
at February 2, 2010 10:50 by ginoplusio


Initial Code
function rmdir_recurse($path) {
	$path = rtrim($path, '/').'/';
	$handle = opendir($path);
	while(false !== ($file = readdir($handle))) {
		if($file != '.' and $file != '..' ) {
			$fullpath = $path.$file;
			if(is_dir($fullpath)) rmdir_recurse($fullpath); else unlink($fullpath);
		}
	}
	closedir($handle);
	rmdir($path);
}

Initial URL
http://www.barattalo.it/2010/02/02/recursive-remove-directory-rmdir-in-php/

Initial Description

                                

Initial Title
PHP recursive remove directory

Initial Tags
php, directory

Initial Language
PHP