GX-Bug #42812 » __kill_files.php
| 1 |
<?php
|
|---|---|
| 2 |
$list=explode("\n"," |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
"); |
| 8 |
|
| 9 |
function delTree($dir) { |
| 10 |
$files = array_diff(scandir($dir), array('.','..')); |
| 11 |
foreach ($files as $file) { |
| 12 |
(is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file"); |
| 13 |
}
|
| 14 |
return rmdir($dir); |
| 15 |
}
|
| 16 |
|
| 17 |
foreach ($list as $item) { |
| 18 |
$item=trim($item); |
| 19 |
if ($item) { |
| 20 |
|
| 21 |
if (file_exists($item)) { |
| 22 |
echo $item." "; |
| 23 |
if (is_dir($item)) { |
| 24 |
if (delTree($item)) echo "Dok"; else echo "Dmeh"; |
| 25 |
} else { |
| 26 |
if (unlink($item)) echo "ok"; else echo "meh"; |
| 27 |
}
|
| 28 |
echo " <br>"; |
| 29 |
}
|
| 30 |
|
| 31 |
}
|
| 32 |
}
|