-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathremoveFile.php
More file actions
31 lines (29 loc) · 802 Bytes
/
Copy pathremoveFile.php
File metadata and controls
31 lines (29 loc) · 802 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
30
31
<?php
function removeFile($path){
$handle=opendir($path);
while (($item=readdir($handle)) !== false){
if ($item != '.' && $item !='..'){
$filename=$path.$item;
if (is_dir($filename)){
if(count(scandir($filename)) == 2){
rmdir($filename);
}else{
removeFile($filename.'/');
}
}elseif (is_file($filename)){
if ((time() - filectime($filename)) >= 7*24*3600){
unlink($filename);
}
}
}
}
closedir($handle);
}
$arr=array(
'/home/www/html/PSO/Excel/Control',
'/home/www/html/PSO/Excel/Input',
'/home/www/html/PSO/Excel/Output',
);
foreach ($arr as $path){
removeFile($path);
}