|
Revision 2914, 1.3 kB
(checked in by pmjones, 9 months ago)
|
updated comments
|
- Property svn:executable set to
- Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
function getBadFiles($base, $dir = null) |
|---|
| 16 |
{ |
|---|
| 17 |
if ($dir === null) { |
|---|
| 18 |
$dir = $base; |
|---|
| 19 |
} |
|---|
| 20 |
|
|---|
| 21 |
$list = array(); |
|---|
| 22 |
foreach (scandir($dir) as $name) { |
|---|
| 23 |
|
|---|
| 24 |
if ($name == '.' || $name == '..' || $name == '.svn') { |
|---|
| 25 |
|
|---|
| 26 |
continue; |
|---|
| 27 |
} |
|---|
| 28 |
|
|---|
| 29 |
$result = "$dir/$name"; |
|---|
| 30 |
|
|---|
| 31 |
if (is_dir($result)) { |
|---|
| 32 |
|
|---|
| 33 |
$sub = getBadFiles($base, $result); |
|---|
| 34 |
$list = array_merge($list, $sub); |
|---|
| 35 |
} else { |
|---|
| 36 |
|
|---|
| 37 |
if (substr($name, 0, 1) == '.' || |
|---|
| 38 |
substr($name, -1) == '~') { |
|---|
| 39 |
$list[] = $result; |
|---|
| 40 |
} |
|---|
| 41 |
} |
|---|
| 42 |
} |
|---|
| 43 |
|
|---|
| 44 |
asort($list); |
|---|
| 45 |
return $list; |
|---|
| 46 |
} |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
foreach (getBadFiles('.') as $name) { |
|---|
| 50 |
echo "$name\n"; |
|---|
| 51 |
unlink($name); |
|---|
| 52 |
} |
|---|