-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprojectDestroyer.php
More file actions
29 lines (26 loc) · 845 Bytes
/
projectDestroyer.php
File metadata and controls
29 lines (26 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
function delTree($dir) {
$files = array_diff(scandir($dir), array('.','..'));
foreach ($files as $file) {
(is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file");
}
return rmdir($dir);
}
$keeps[]=".";
$keeps[]="..";
$keeps[]="appInfos.json";
$keeps[]="projectDestroyer.php";
$keeps[]="projectGeneration.php";
foreach (scandir(getcwd()) as $key => $value) {
if(!in_array($value, $keeps)) {
if (is_dir($value)) {
echo "deleting folder : $value\r\n";
delTree($value);
}else{
echo 'rm '.$value."\r\n";
$output = shell_exec('rm '.$value);
print_r($output);
}
}
}
$output = shell_exec('rm projectDestroyer.php');