maxwen | 9432906 | 2017-02-17 01:29:13 +0100 | [diff] [blame] | 1 | <?php |
| 2 | |
| 3 | function list_files($path) { |
| 4 | $output = array(); |
| 5 | $files = scandir($path); |
| 6 | if ($path == "./_h5ai" || $path == "./.bak") return $output; |
| 7 | |
| 8 | foreach ($files as $file) { |
| 9 | if ($file == "." || $file == ".." || strpos($file, '.html') |
| 10 | || $file == ".bak" || $file == "_h5ai") { |
| 11 | continue; |
| 12 | } |
| 13 | |
| 14 | if (is_dir($path.'/'.$file)) { |
maxwen | 8754f05 | 2018-10-21 16:40:43 +0200 | [diff] [blame] | 15 | $output[$path.'/'.$file] = list_files($path.'/'.$file); |
maxwen | 9432906 | 2017-02-17 01:29:13 +0100 | [diff] [blame] | 16 | } else { |
| 17 | $output[] = array("filename"=>$file, "timestamp"=>filemtime($path.'/'.$file)); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | return $output; |
| 22 | } |
| 23 | |
| 24 | //chdir("../"); |
| 25 | echo json_encode(list_files(".")); |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | ?> |
| 31 | |