Ey allo, sorry voor het vorige topic
mja QuickBASIC is in my head... nu zit ik met het volgende, ik wil per directory het aantal bestanden laten zien... maar zie het alleen op de hoogste directory
wie ziet waar ik de fout in ga (code is half van iemand anders
)
dit is nu de uitkomst
etc etc etc
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
| <? function newdir($file){ global $level; $tmphandle = opendir($file); chdir($file); $level++; while (false !== ($file = readdir($tmphandle))) file_or_dir($file); $level--; chdir(".."); closedir($tmphandle); } function file_or_dir($file){ global $start, $count, $lastdir, $lastcount; if ($file != "." &amp;&amp; $file != "..") { $dir = getcwd(); $text = $dir . "/" . $file; $text = str_replace("\\", "/", $text); if (is_dir($file)) { if ($lastdir != "") { echo $lastdir . " total files: $count<br>"; $lastdir = $text; $count = 0; }else{ $lastdir = $text; } newdir($file); } else { $count++; } } } $level = -1; $start = strlen(getcwd()); newdir("e:/gallery/female"); ?> |
dit is nu de uitkomst
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| e:/gallery/female/adriana_lima total files: e:/gallery/female/adriana_lima/thumbnails total files: 181 e:/gallery/female/adriana_sklenarikova total files: 0 e:/gallery/female/adriana_sklenarikova/thumbnails total files: 640 e:/gallery/female/aishwarya_rai total files: 0 e:/gallery/female/aishwarya_rai/thumbnails total files: 67 e:/gallery/female/alanis_morissette total files: 0 e:/gallery/female/alanis_morissette/thumbnails total files: 577 e:/gallery/female/alexandra_kamp total files: 0 e:/gallery/female/alexandra_kamp/thumbnails total files: 73 e:/gallery/female/ali_landry total files: 0 e:/gallery/female/ali_landry/thumbnails total files: 244 e:/gallery/female/alice_dodd total files: 0 e:/gallery/female/alice_dodd/thumbnails total files: 52 e:/gallery/female/alice_marie total files: 0 e:/gallery/female/alice_marie/thumbnails total files: 49 e:/gallery/female/alicia_silverstone total files: 0 e:/gallery/female/alicia_silverstone/thumbnails total files: 1825 |
etc etc etc