Thread: folder scan
View Single Post
Old 10-11-2010, 08:35 PM   #6 (permalink)
medvirus
The Wanderer
 
Join Date: Oct 2010
Posts: 9
Thanks: 2
medvirus is on a distinguished road
Default

Nice work and thanks ++
bro i understand my query 100% and solve my problem
actually what i want to make form your script is like this , which i make from below script
PHP Code:
<?php
function dirlist($dir$bool "dirs"){
   
$truedir $dir;
   
$dir scandir($dir);
   if(
$bool == "files"){ // dynamic function based on second pram
      
$direct 'is_dir';
   }elseif(
$bool == "dirs"){
      
$direct 'is_file';
   }
   foreach(
$dir as $k => $v){
      if((
$direct($truedir.$dir[$k])) || $dir[$k] == '.' || $dir[$k] == '..' || $dir[$k] == 'my.php' ){
         unset(
$dir[$k]);
      }
   }
   
$dir array_values($dir);
   return 
$dir;
}
?>
<table align=center width=100%>

<?php
echo "<tr bgcolor=#990000><td>";
$dop="D:\/family_picture/4dham/2010/";
echo 
"<b><font face=\"BN Machine\" color=\"#FFFFFF\">File OF $dop</font></b></td></tr>";
//main dir file
$filem=dirlist("$dop""files");

while(list(
$kf,$vf)=each($filem))
                                {
$kf=$kf+1;
                               echo 
"<tr bgcolor=#FFCC66><td align=center><b><font color=\"#000066\"> $kf:$vf</font></b></td></tr> " ;
                                }




//main dir
$dirl=dirlist("$dop");
while(list(
$k,$v)=each($dirl))
                                { 
$k=$k+1;
                                  echo 
"<tr bgcolor=#FF6600><td align=right><b><font face=\"Martina\"color=\"#000000\" ><h1>Folder OF $dop</h1></font></b></td></tr> " ;
                                  echo 
"<tr bgcolor=#006699><td align=center><b><font color=\"#000000\"> <h1><i>$k</i>->$v</h1></font></b></td></tr> " ;


                                  
//Sub Dir Files
                                
$fils=dirlist("$dop/$v/""files");
                                 while(list(
$k1,$v1)=each($fils))
                                {
$k1=$k1+1;
                                 echo 
"<tr bgcolor=#FFCC66><td align=center><b><font color=\"#CC0000\"><i> $k1</i>->$v1</font></b></td></tr> " ;

                                }
                                 
//Subsub Dir
                                 
$fild=dirlist("$dop/$v/");
                                 while(list(
$k11,$v11)=each($fild))
                                {  
$k11=$k11+1;
                                
//echo "<tr bgcolor=#00FF99><td align=left><b><font color=\"#000000\">Folder of $k:$v</font></b></td></tr> " ;
                                   
echo "<tr bgcolor=#FF99CC><td align=left><b><font face=\"Autumn\" color=\"#000000\"> <h2><i>$k11</i>->$v11 th $v</h2></font></b></td></tr> " ;

                                 
//SUbSUb dirfiles
                                
$fils1=dirlist("$dop/$v/$v11/""files");
                                 while(list(
$k111,$v111)=each($fils1))
                                {  
$k111=$k111+1;
                                  echo 
"<tr bgcolor=#660000><td align=center><b><font color=\"#FFFFFF\"> <i>$k111</i>->$v111</font></b></td></tr> " ;


                                }

                                }

                                }

?>
</table>
just check and tell me that how i use your script instead of this becouse this script has one drawback is
i have to manually add while loop in it , and it make script big,
i wan to short this script as much as possible...

My main aim is , i have to scan file from all folder and move them to one folder.
medvirus is offline  
Reply With Quote