-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete.php
31 lines (21 loc) · 742 Bytes
/
delete.php
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
30
31
<?php
$noImages=true;
$extension="png";
if ($handle = opendir('./images/.')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
$file_ext = pathinfo($entry, PATHINFO_EXTENSION);
if (strtolower($file_ext) == strtolower($extension) || strtoupper($file_ext) == strtolower($extension)) {
if (!unlink('./images/'.$entry)){
echo ("Error deleting $entry <br/>\n");
}
else {
echo ("Deleted $entry <br/>\n");
$noImages=false;
}
}
}
}
closedir($handle);
}
if ($noImages) echo "No images found";