Snukzz Posted September 13, 2004 Report Posted September 13, 2004 Mekleeju, mekleeju, bet neatradu funkciju, kas saskaita konkreetaa folderii failus un izvada to skaitu. Varbuut kaac zin ar kaadu fiichu lai kaut ko tamliidziigu uzcep? ;)
Snukzz Posted September 13, 2004 Author Report Posted September 13, 2004 $gallery = opendir($whichSection . "/gallery/" . $who . "/"); $counter = 0; while($file = readdir($gallery)){ if($file != '.' && $file != '..'){ $counter++; } } closedir($gallery); echo($counter); Sitas ir tas? :huh:
bubu Posted September 13, 2004 Report Posted September 13, 2004 Pameklē manuālī funkcijas opendir un readdir.
Snukzz Posted September 13, 2004 Author Report Posted September 13, 2004 Pammedjinaaju sitaa <?php if ($handle = opendir('textures/cmr04/carz/archive')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo count("$file\n"); } } closedir($handle); } ?> Sis man izdeva chupu ar 1111111 :huh:
рпр Posted September 13, 2004 Report Posted September 13, 2004 tev tos 1 vajag saskaitiit, tad buus labi
Snukzz Posted September 13, 2004 Author Report Posted September 13, 2004 paproveeju sitaa <?php if ($handle = opendir('textures/cmr04/carz/archive')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $cik=count("$file\n"); } }echo sum($cik); closedir($handle); } ?> Sis man izvada 1 <_<
Snukzz Posted September 13, 2004 Author Report Posted September 13, 2004 Karoche kaut ko sakjimereeju <? $dr = opendir("textures/cmr04/carz/archive/$subcat"); while (false !== ($files = readdir($dr))) { if (preg_match('/\.rar$/i', $files)) { $filedb[] = $files; } } $numfiles=count($filedb); echo $numfiles; ?> Laikam pat straadaa! Tikai kaa lai piespiezj nolasit jebkuru failu? :huh:
bubu Posted September 13, 2004 Report Posted September 13, 2004 (edited) Nē, nu šitā rēcis sen nebiju :D Pats otrajā postā uzrakstīji kodu, kas to dara, ko tev vajag! :D Otrajā koda gabalā tu atkal nevis skaitīji, bet izvadīji katram failam vērtību 1. Trešais koda gabals atkal kautkāds galīgs murgs ir, tas neko jēdzīgu nedara. ;) Ceturtajā koda gabalā kautko jau tu skatitīji (.rar failus), bet ļoti neoptimāli, jo visus ielasīji masīvā, kas nav labi, ja tev tos failu nosaukumus nevajadzēs izmantot. Tā ka ņem vien to pirmo (vai otro, pielabojot tā lai skaita nevis echo taisa) koda gabalu un lieto laimīgs :) Edited September 13, 2004 by bubu
Snukzz Posted September 13, 2004 Author Report Posted September 13, 2004 :P Smejies, smejies es tur meegjinaaju principu izkost - beigas laikam taapat nesanaaca!:P Gan jau veel kaut ko smiekliigu uzskriptoshu!:P
arnico Posted September 14, 2004 Report Posted September 14, 2004 vai tik nebuus itaa? <?php if ($handle = opendir('textures/cmr04/carz/archive')) { $sk=0; while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $sk++; } } closedir($handle); echo $sk; } ?> Vispaar jau tikai drusciit pamainiits otrais ieposteetais koda gabals :)
Recommended Posts