PHP Recursive rmdir, hapus directory dan subdirectory nya

Share

Recursive rmdir

function rrmdir($src) {
$dir = opendir($src);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
$full = $src . '/' . $file;
if ( is_dir($full) ) {
rrmdir($full);
}
else {
unlink($full);
}
}
}
closedir($dir);
chmod($src, 0777);
rmdir($src);
}

Read More

Leave a Reply

Your email address will not be published. Required fields are marked *