Blitz Posted September 22, 2005 Report Share Posted September 22, 2005 Ir kadam gatavs skripts visa hdd satura nolasisanai? Ja ir varbut vareu padalities? Link to comment Share on other sites More sharing options...
Delfins Posted September 22, 2005 Report Share Posted September 22, 2005 opendir() + readdir() rekursijā max 20 koda rindiņas... slinkums? ir google arī... Link to comment Share on other sites More sharing options...
Blitz Posted September 22, 2005 Author Report Share Posted September 22, 2005 Meiginaju, bet kaut kaa nesanaak... Pasakiet kur ir kluuda? Mapee OK ir vel 3 mapes "03, 04, 05" <?php $dir="C:/OK"; $index=0; function traverse_dir($dir) { $handle=opendir($dir); while ($file=readdir($handle)) { if ($file!=="." and $file!=="..") { $str1=substr_count($file,"."); if ($str1==0) { $masivs[$index]=$file; $index++; } } } print_r($masivs); foreach ($masivs as $subdir) { echo "<b>$subdir</b><br>"; traverse_dir($subdir); } } traverse_dir($dir); ?> Array ( []=> 03 [1] => 04 [2] => 05 ) 03 Warning: opendir(03) [function.opendir]: failed to open dir: Invalid argument in c:\Inetpub\wwwroot\Foto\bildes.php on line 7 Warning: readdir(): supplied argument is not a valid Directory resource in c:\Inetpub\wwwroot\Foto\bildes.php on line 8 Link to comment Share on other sites More sharing options...
bubu Posted September 22, 2005 Report Share Posted September 22, 2005 Padomā pats, cik ir $subdir vērtība izsaucot rekursīvi to traverse_dir() funkciju. Link to comment Share on other sites More sharing options...
Blitz Posted September 22, 2005 Author Report Share Posted September 22, 2005 $subdir vertiba ir 03, 04 un 05 pie katra foreach... Link to comment Share on other sites More sharing options...
bubu Posted September 22, 2005 Report Share Posted September 22, 2005 nu un kas notiek tālāk, padomā.. Link to comment Share on other sites More sharing options...
Blitz Posted September 22, 2005 Author Report Share Posted September 22, 2005 vai nu meklee nakamo direktoriju $dir/$subdir vai vienkarsi $subdir.... Link to comment Share on other sites More sharing options...
Delfins Posted September 22, 2005 Report Share Posted September 22, 2005 nu vot tu pats atbildēji... a kā viņš zinās ka tavs $subdir ir iekš $dir !? Tā arī raksti traverse_dir( $dir.'/'.$subdir); Link to comment Share on other sites More sharing options...
Blitz Posted September 22, 2005 Author Report Share Posted September 22, 2005 Super... paldies jums :) Link to comment Share on other sites More sharing options...
Recommended Posts