-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilesystem.php
51 lines (45 loc) · 1.07 KB
/
filesystem.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
//echo "<pre>";
//echo update_subsubdir("footage/folder2",0,0);
function check_subdir($path,$subdir){
if (is_dir("$path")) {
if (is_writable("$path")) {
if (is_dir("$path/$subdir")) {
if (is_writable("$path/$subdir"))
return 0;
else
return -2;
}else{
$old = umask(0);
mkdir("$path/$subdir",0777);
umask($old);
if (!is_dir("$path/$subdir")) return -3;
else return 0;
}
}
}else{
return -1;
}
}
function update_subsubdir($path,$index,$limit,$index_max=100000){
if ($index<=$index_max) {
if (!is_dir("$path/$index")) {
// if (!@mkdir("$path/$index",0777)) return -2;
// else return $index;
$old = umask(0);
if (!@mkdir("$path/$index",0777)) return -2;
umask($old);
return $index;
}else{
$files = scandir("$path/$index");
if (count($files)>=$limit+2) return update_subsubdir($path,$index+1,$limit);
else return $index;
}
}else{
return -1;
}
}
function get_free_space($path){
return disk_free_space($path);
}
?>