-
Notifications
You must be signed in to change notification settings - Fork 1
/
directory.php
37 lines (31 loc) · 972 Bytes
/
directory.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
<?php
/*$dir= "C:/Users/Dhaval/Downloads/Astangahrdayasamhita_txt/";
$filename = glob("C:/Users/Dhaval/Downloads/Astangahrdayasamhita_txt/*.txt");
$filenew = str_replace($dir,$dir."new/",$filename);
$h=0;
while ($h<count($filename))
{
echo $filename[$h]."<br>";
$h++;
}*/
function ListFiles($dir) {
if($dh = opendir($dir)) {
$files = Array();
$inner_files = Array();
while($file = readdir($dh)) {
if($file != "." && $file != ".." && $file[0] != '.') {
if(is_dir($dir . "/" . $file)) {
$inner_files = ListFiles($dir . "/" . $file);
if(is_array($inner_files)) $files = array_merge($files, $inner_files);
} else {
array_push($files, $dir . "/" . $file);
}
}
}
closedir($dh);
return $files;
}
}
$a = Listfiles('C:/Users/Dhaval/Downloads/Astangahrdayasamhita_txt');
echo $a[1];
?>