Voting

: six minus zero?
(Example: nine)

The Note You're Voting On

lprent at primary dot geek dot nz
11 years ago
It is rather dangerous to recurse into symbolically linked directories. The delTree should be modified to check for links.

<?php
public static function delTree($dir) {
$files = array_diff(scandir($dir), array('.','..'));
foreach (
$files as $file) {
(
is_dir("$dir/$file") && !is_link($dir)) ? delTree("$dir/$file") : unlink("$dir/$file");
}
return
rmdir($dir);
}
?>

<< Back to user notes page

To Top