Link to home
Start Free TrialLog in
Avatar of archker
archker

asked on

Sort dirs by creation date

On my site, I have a php page that lists all directories. How can I sort that list in creation order?

/Helen
Avatar of VGR
VGR

the function to get their creation time is (surprinsingly) ctime()
to sort them requires a usort() trick or a "normal" sorting, or some other technique

I suggest you let the OS do the work like this :

   $directory2=str_replace('/','\\',$directory);
   $d = @popen ("dir /ON /B $directory2", "r"); // triés par ordre alphabétique
   while (!feof ($d)) {
    $buffer = fgets($d, 4096);
    $entry=chop($buffer);
    if (($entry<>'.') and ($entry<>'..') and ($entry<>'')) {
  // do your stuff on $entry
  // you may want to use is_dir() to treat only directories (but not . nor ..)
    } // if affichage
   } // while
   $toto=@pclose($d);
Avatar of archker

ASKER

Alright, that worked somewhat good, but, maybe I should have been more specific. This is the code I use for the page to generate a table with names based on text-files in dirs.

<?php

$numberOfColumn=3;

function getAlbumTableList($before="", $after="") {
     global $browse;
     echo "<div id=\"albumbrowser\">\n$before";
     print_table($browse);
     echo "$after</div>";
}

# ****************************************************************************************
# 'Private' functions
# ****************************************************************************************
function print_table($starting_directory, $toBePrinted="") {
     global $display_abstract, $album_php_config, $lang, $numberOfColumn;

     $to_print="";
     include('inc/album_config.php');

     $directory_link=$starting_directory;
     if ($directory_link==".") {
          $directory_link="";
     }

     if (file_exists("$directory_link$album_php_config")) {
          include("$directory_link$album_php_config");
     }
     
     $is_picture_directory=false;
     $down_printed=false;
     $all_dir = array();
     if($d_obj = dir($starting_directory)) {
          while($this_entry = $d_obj->read()) {
               if ($this_entry != "." && $this_entry != ".." && $this_entry != $thumb_dir) {
                    if(is_dir("$directory_link$this_entry")) {
                         if (isValidPictureDirectory("$directory_link$this_entry")) {
                              $all_dir[] = $this_entry;
                         }
                    }
                    if (is_file("$directory_link$this_entry")) {
                         if (isValidPictureFile("$directory_link$this_entry") != boolean) {
                              $is_picture_directory=true;
                         }
                    }    
               }
          }
          $d_obj->close();
     } else {
          echo "Error!  Couldn't list directory $starting_directory for some reason!<br />";
          exit;
     }
     $keep_going=true;
     $x=0;
     $y=0;
     $z=0;
     $width=round(100/$numberOfColumn);
     echo "<table id=\"albumsListTable\" width=\"476\">\n";
     while ($keep_going) {
          echo "   <tr class=\"albumsLine\">\n";
          while ($y < $numberOfColumn) {
               if ($z<sizeof($all_dir)) {
                    echo "<td class=\"albumsCell\" width=\"$width%\" align=\"center\" valign=\"top\">";
                    echo "<a href=\"album.php?album=";
                    echo $all_dir[$z];
                    echo "\">";
                    echo getAlbumTitleText("$all_dir[$z]/");
                } else {
                    echo "<td class=\"noAlbumsCell\" width=\"$width%\" align=\"center\" valign=\"top\">&nbsp;</td>\n";
                    $keep_going=false;
               }
               $y++;
               $z++;
          }
          $x++;
          $y=0;
          echo "   </tr>\n";
     }
     echo "</table>\n";
     
}
?>

Any way to make it sort the dirs, (i.e. the info in the album.txt-file), chronological?

/Helen
note that this line doesn't work as you expected :
        if ($this_entry != "." && $this_entry != ".." && $this_entry != $thumb_dir) {

$thumb_dir is undefined in print_table()
to solve your ordering problem, I would replace these lines :

  if($d_obj = dir($starting_directory)) {
    while($this_entry = $d_obj->read()) {

by those :

  if($d_obj = @popen ("dir /ON /B $starting_directory", "r") ) {
  while (!feof ($d_obj)) {
   $buffer = fgets($d_obj, 4096);
   $this_entry=chop($buffer);

and I would replace also
$d_obj->close();
by
$toto=@pclose($d_obj);
Avatar of archker

ASKER

sorry, didn't work. It dosn't show any columns.
I'm really bad at php, so please be really specific when you ask me to change code =)
ok, full source then

<?php

$numberOfColumn=3;

function getAlbumTableList($before="", $after="") {
    global $browse;
    echo "<div id=\"albumbrowser\">\n$before";
    print_table($browse);
    echo "$after</div>";
}

# ****************************************************************************************
# 'Private' functions
# ****************************************************************************************
function print_table($starting_directory, $toBePrinted="") {
    global $display_abstract, $album_php_config, $lang, $numberOfColumn;

    $to_print="";
    include('inc/album_config.php');

    $directory_link=$starting_directory;
    if ($directory_link==".") {
         $directory_link="";
    }

    if (file_exists("$directory_link$album_php_config")) {
         include("$directory_link$album_php_config");
    }
   
    $is_picture_directory=false;
    $down_printed=false;
    $all_dir = array();

if($d_obj = @popen ("dir /ON /B $starting_directory", "r") ) {
 while (!feof ($d_obj)) {
  $buffer = fgets($d_obj, 4096);
  $this_entry=chop($buffer);
              if ($this_entry != "." && $this_entry != ".." && $this_entry != $thumb_dir) {
                   if(is_dir("$directory_link$this_entry")) {
                        if (isValidPictureDirectory("$directory_link$this_entry")) {
                             $all_dir[] = $this_entry;
                        }
                   }
                   if (is_file("$directory_link$this_entry")) {
                        if (isValidPictureFile("$directory_link$this_entry") != boolean) {
                             $is_picture_directory=true;
                        }
                   }    
              }
         }
$toto=@pclose($d_obj);
    } else {
         echo "Error!  Couldn't list directory $starting_directory for some reason!<br />";
         exit;
    }
    $keep_going=true;
    $x=0;
    $y=0;
    $z=0;
    $width=round(100/$numberOfColumn);
    echo "<table id=\"albumsListTable\" width=\"476\">\n";
    while ($keep_going) {
         echo "   <tr class=\"albumsLine\">\n";
         while ($y < $numberOfColumn) {
              if ($z<sizeof($all_dir)) {
                   echo "<td class=\"albumsCell\" width=\"$width%\" align=\"center\" valign=\"top\">";
                   echo "<a href=\"album.php?album=";
                   echo $all_dir[$z];
                   echo "\">";
                   echo getAlbumTitleText("$all_dir[$z]/");
               } else {
                   echo "<td class=\"noAlbumsCell\" width=\"$width%\" align=\"center\" valign=\"top\">&nbsp;</td>\n";
                   $keep_going=false;
              }
              $y++;
              $z++;
         }
         $x++;
         $y=0;
         echo "   </tr>\n";
    }
    echo "</table>\n";
   
}
?>
as far as columns are concerned, it shouldn't change anything. I only modified the way you get $this_entry
Avatar of archker

ASKER

Still, doesn't display anything.
Maybe there's another way?
Avatar of archker

ASKER

Cant use fileatime to compare it and display the oldest first?
1)"Alright, that worked somewhat good" : so my code does display the files (and directories) in the order you want
2)"Still, doesn't display anything." : ???

I just slightly modified your code (supposed to display something, right ? :D ) so that files (rather "directories") are taken differently. The rest (display etc) is 100% your code

So I don't understand.

PS : toBePrinted is not used at all in print_table()
PPS : I'm trying to run the script, yours, mine, and the combination. Later.
could I see file 'inc/album_config.php' ?
Avatar of archker

ASKER

perhaps adopt this code???
Found it somehwre but cant apply it...



$directory = "$album/";
$files = array();
$columnSpan = 4;

$handle = opendir($directory);
$i = 0;
while($filename = readdir($handle))
{
if ($filename <> '.' && $filename <> '..')
{
$files[$i] = array(filemtime($directory .$filename), $filename);
$i ++;
}
}

arsort($files);
reset($files);
yes archker, but it should use ctime() not mtime() AFAIK
Avatar of archker

ASKER

then how would the code look in the whole context?
As I wrote above when I said "full code"

I'm still waiting for the 'inc/album_config.php' file to be able to run the scripts


Listening...
Avatar of archker

ASKER

well, it just doesn't display any colums, it's just blank, but at least it doesnt say any error messeges, so it's somewhat good I guess =)

you can get allt the other files from http://www.chevillat.ch/sp/soft/picsPHP/  I modified it of cource ALOT but all the files u need should be there.

/Helen
I need the PHP script, NOT THE HTML FILE THAT WILL BE RETURNED IN MY BROWSER
I need the PHP script, NOT THE HTML FILE THAT WILL BE RETURNED IN MY BROWSER
I need the PHP script, NOT THE HTML FILE THAT WILL BE RETURNED IN MY BROWSER
I need the PHP script, NOT THE HTML FILE THAT WILL BE RETURNED IN MY BROWSER

I tried to directly include the above URL but to no avail

It's not very serious to ask for help on a script that can't be run 8-)
Avatar of archker

ASKER

It can be run.... sigh, but it consist of multiple files!
(download the entire thing from http://www.chevillat.ch/sp/soft/picsPHP/download.php ) that's what I meant.

But sure =), if you think the album_config will help:

<?php

     # ****************************************************************************************
     #
     # ****************************************************************************************
     # number of lines and columns per page for the pictures index
     $lines=4;
     $cols=3;
     
     # number besides the thumbnail
     # 1: yes, 2: no
     $display_number=0;
     
     # stylesheet
      $album_stylesheets=array('default.css');
     
     # Are the thumbnails available somewhere ?
     # 1: yes, 0: no
     # If not the original pictures will be resized by the browser (not suitable)!
     $thumb=1;

     # if yes, which repertory are they ? and what is the 'prefix' of the thumbnails ?
     $thumb_dir="";
     $thumb_prefix="t_";

     # if not, what percentage the thumbnails should be ?
     # 100%= the thumbnails are the same size than the picture itself.
     # 50%=half of the original size
     # 0%=not a valid value
     $thumb_resize=50;
     

     $nb_thumb_navigation=5;
     
     
?>
sorry for having not found download.php by myself 8-))
testing... I hope default.css is not essential also 8-)
Sorry, but some definition of those variables is missing :

   if (file_exists("$directory_link$album_php_config")) {
        include("$directory_link$album_php_config");
in your script, the variables $directory_link and $album_php_config are not set, are not declared, are not set up by an include file, are not passed as parameters to the print_table() function, are not global variables (no session_start(); at the beginning)...

HOW COULD THIS WORK ???!!??
Sorry also, but your downloaded files produce this :

Warning: getimagesize: Unable to open '/' for reading. in ***\picsphp\inc\functions.php on line 223

I don't have time to re-configure all your includes

I maintain that IF your code did produce results before we touched it, and IF my code did "perform well" (sic) for sorting the directories the way you wanted, THEN combining both the way I did above SHOULD WORK.
Avatar of archker

ASKER

hmmm, odd. Becouse when I use the code you gave me, the table that displeyed all dirs just comes up totally blank.

Go here to get all the files I use, if you want to help me:
http://www.fantasygallery.net/php.zip

I really appriciate the help you're giving me.
I really don't think there's alot of undefined functions, u just have to look at all the php-pages included. It's sort-of annoingly complicated I guess.

(explaination: there is an index.php and and album.php and a picture.php that calls for several files that in their turn calls for several files, which has several functions and draws their definitions from perhaps not their own files but other files which also are included.......)
It is index.php that calls for this list of directiories.

/Helen
i would like to see the HTML source of the page "totally blank", PLEASE
Avatar of archker

ASKER

that's the index.php file in the zip file
not the PHP source, the source (HTML code) of the GENERATED PAGE

execute my script, it comes "blank" - fine.
Do rightclick/view source and copy-paste this here

thanks
Avatar of archker

ASKER

or I mean: fantasygallery.net =) changed the code to your model now...

(btw it's the album_special_functions.php which holds the code for the table)
Avatar of archker

ASKER

perhaps you have to have a few subdirectories to where you place the files. IE a few dirs with images, and in each dir a file named album.txt only with one line of text, fx a name or so. =)
Avatar of archker

ASKER

sorry, I keep misunderstanding you. I guess I'm just really stupid sometimes.
run my script "that performed well"
the page is supposed to come out BLANK
GET THE SOURCE HTML OF THAT PAGE BY RIGHT-CLICKING IN THE BROWSER'S WINDOW AND choosing "view page source"

and COPY-PASTE WHAT YOU OBTAIN HERE
Avatar of archker

ASKER

sure I just figured it's be easier if you looked at the page instead of posting alot of unnessesery code here...


<html>
<head>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     <title>Fantasy Art Gallery</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="inc/css/default.css" rel="stylesheet" type="text/css">
<link REL="SHORTCUT ICON" HREF="http://www.fantasygallery.net/inc/gal.ico">
</head>

<div align="left">

  <table width="720" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td align="left" valign="top" style="background-color:#000000; background-image:  url(/inc/drake.gif);background-repeat: no-repeat;">

  <table width="720" cellspacing="0" cellpadding="0" style="border:3px;border-style:solid;border-color:#000000">
    <tr>
      <td width="121" height="112">
       </td>
       <td valign="bottom" width="599" height="112" align="left" background="/inc/logo.jpg"><img src="/inc/black.gif" height="4" width="100%" style="border:0px"></td>
    </tr>
    <tr>
      <td width="121"><img src="/inc/invis.gif" width="121" style="border:0px"></td>
      <td background="/inc/bg.gif" valign="top" align="right" width="599">
<div align="right">
        <table width="536" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="center">
<br>
--- ::: ------ :::: --------- :::::::::::::::::::::::::: --------- :::: ------ ::: ---
<br>
<br>
<br>
<br>
--- ::: ------ :::: --------- :::::::::::::::::::::::::: --------- :::: ------ ::: ---
<br>
<br>
<br>
<br>
<div id="albumbrowser">
<table id="albumsListTable" width="476">
   <tr class="albumsLine">
<td class="noAlbumsCell" width="33%" align="center" valign="top">&nbsp;</td>
<td class="noAlbumsCell" width="33%" align="center" valign="top">&nbsp;</td>
<td class="noAlbumsCell" width="33%" align="center" valign="top">&nbsp;</td>
   </tr>
</table>
</div>--- ::: ------ :::: --------- :::::::::::::::::::::::::: --------- :::: ------ ::: ---
<br>
<br>
Old masters will be added soon
<br>
<br>
--- ::: ------ :::: --------- :::::::::::::::::::::::::: --------- :::: ------ ::: ---
<br>
<br>
     </td>
          </tr>
        </table>
</div>
      </td>
    </tr>
    <tr>
      <td width="121"><img src="/inc/invis.gif" width="121" style="border:0px"></td>
      <td background="/inc/down.jpg" valign="top" align="right" width="599" height="116">

</td>
    </tr>
  </table>
      </td>
    </tr>
  </table>

</div>
</body>
</html>
so sizeof($all_dir)) =0 as per your code

I suggest to debug the part just before :

}
//test
$DEBUGTEST=1;
//
   
    $is_picture_directory=false;
    $down_printed=false;
    $all_dir = array();
if ($DEBUGTEST==1) echo "all_dir[] cleaned<BR>";
    if($d_obj = dir($starting_directory)) {
if ($DEBUGTEST==1) echo "ok getdir of '$starting_directory'<BR>";
         while($this_entry = $d_obj->read()) {
if ($DEBUGTEST==1) echo "entry '$this_entry' found <BR>";
              if ($this_entry != "." && $this_entry != ".." && $this_entry != $thumb_dir) {
if ($DEBUGTEST==1) echo "entry '$this_entry' accepted as candidate<BR>";
                   if(is_dir("$directory_link$this_entry")) {
if ($DEBUGTEST==1) echo "entry '$this_entry' is a directory<BR>";
                        if (isValidPictureDirectory("$directory_link$this_entry")) {
if ($DEBUGTEST==1) echo "entry '$this_entry' passed isValidPictureDirectory, added to all_dir<BR>";
                             $all_dir[] = $this_entry;
                        }
                   }
                   if (is_file("$directory_link$this_entry")) {
if ($DEBUGTEST==1) echo "entry '$this_entry' is a file<BR>";
                        if (isValidPictureFile("$directory_link$this_entry") != boolean) {
if ($DEBUGTEST==1) echo "entry '$this_entry' passed absurd test<BR>";
                             $is_picture_directory=true;
                        }
                   }    
              }
         }
         $d_obj->close();
if ($DEBUGTEST==1) echo "end of directories search<BR>";
    } else {
         echo "Error!  Couldn't list directory $starting_directory for some reason!<br />";
         exit;
    }
   


PS : what does mean this code part ???
if (isValidPictureFile("$directory_link$this_entry") != boolean)

boolean is undefined !
is isValidPuctureFile returns a Boolean, then the test should be written as :
if (isValidPictureFile("$directory_link$this_entry"))
Avatar of archker

ASKER

yes well, boolean was just a leftover from some insane moment of mine.

I'll try and debug now...
Avatar of archker

ASKER

well, it finds everything when I run my old code of course:
all_dir[] cleaned
ok getdir of '.'
entry '.' found
entry '..' found
entry 'lockwood' found
entry 'lockwood' accepted as candidate
entry 'lockwood' is a directory
entry 'lockwood' passed isValidPictureDirectory, added to all_dir
entry 'alexander' found
entry 'alexander' accepted as candidate
entry 'alexander' is a directory
entry 'alexander' passed isValidPictureDirectory, added to all_dir
entry 'myalbums.php' found
entry 'myalbums.php' accepted as candidate
entry 'myalbums.php' is a file

und so weiter...

end of directories search

 but when I run the code you altered it only says:

all_dir[] cleaned
ok getdir of '.'
end of directories search


?

ok, just to make sure we write about the same code, I reproduce what I think should be the code so far

function print_table($starting_directory, $toBePrinted="") {
   global $display_abstract, $album_php_config, $lang, $numberOfColumn;

   $to_print="";
   include('inc/album_config.php');

//test
   $DEBUGTEST=1;
//

   $directory_link=$starting_directory;
   if ($directory_link==".") {
        $directory_link="";
   }

   if (file_exists("$directory_link$album_php_config")) {
        include("$directory_link$album_php_config");
   }
   
   $is_picture_directory=false;
   $down_printed=false;
   $all_dir = array();
if ($DEBUGTEST==1) echo "VGR all_dir[] cleaned<BR>";
if($d_obj = @popen ("dir /ON /B $starting_directory", "r") ) {
if ($DEBUGTEST==1) echo "VGR ok getdir of '$starting_directory'<BR>";
while (!feof ($d_obj)) {
 $buffer = fgets($d_obj, 4096);
 $this_entry=chop($buffer);
if ($DEBUGTEST==1) echo "VGR entry '$this_entry' found <BR>";
             if ($this_entry != "." && $this_entry != ".." && $this_entry != $thumb_dir) {
if ($DEBUGTEST==1) echo "VGR entry '$this_entry' accepted as candidate<BR>";
                  if(is_dir("$directory_link$this_entry")) {
if ($DEBUGTEST==1) echo "VGR entry '$this_entry' is a directory<BR>";
                       if (isValidPictureDirectory("$directory_link$this_entry")) {
if ($DEBUGTEST==1) echo "VGR entry '$this_entry' passed isValidPictureDirectory, added to all_dir<BR>";

                            $all_dir[] = $this_entry;
                       }
                  }
                  if (is_file("$directory_link$this_entry")) {
if ($DEBUGTEST==1) echo "VGR entry '$this_entry' is a file<BR>";
                       if (isValidPictureFile("$directory_link$this_entry")) { // CHECK TEST
if ($DEBUGTEST==1) echo "VGR entry '$this_entry' is valid picture file<BR>";
                            $is_picture_directory=true;
                       }
                  }    
             }
        }
$toto=@pclose($d_obj);
if ($DEBUGTEST==1) echo "VGR end of directories search, ".count($all_dir)." elements found.<BR>";
   } else {
        echo "Error!  Couldn't list directory $starting_directory for some reason!<br />";
        exit;
   }
   $keep_going=true;
   $x=0;
   $y=0;
   $z=0;
   $width=round(100/$numberOfColumn);
   echo "<table id=\"albumsListTable\" width=\"476\">\n";
   while ($keep_going) {
        echo "   <tr class=\"albumsLine\">\n";
        while ($y < $numberOfColumn) {
             if ($z<sizeof($all_dir)) {
                  echo "<td class=\"albumsCell\" width=\"$width%\" align=\"center\" valign=\"top\">";
                  echo "<a href=\"album.php?album=";
                  echo $all_dir[$z];
                  echo "\">";
                  echo getAlbumTitleText("$all_dir[$z]/");
              } else {
                  echo "<td class=\"noAlbumsCell\" width=\"$width%\" align=\"center\" valign=\"top\">&nbsp;</td>\n";
                  $keep_going=false;
             }
             $y++;
             $z++;
        }
        $x++;
        $y=0;
        echo "   </tr>\n";
   }
   echo "</table>\n";
   
}
?>


just fix the "strange test with != boolean" and run it.
Thanks
Avatar of archker

ASKER

now it says

VGR all_dir[] cleaned
VGR ok getdir of '.'
VGR entry '' found
VGR end of directories search, 0 elements found.
Well, I tested this code :
<?
$directory='.';
  $directory2=str_replace('/','\\',$directory);
  $d = @popen ("dir /ON /B $directory2", "r"); // triis par ordre alphabitique
  while (!feof ($d)) {
   $buffer = fgets($d, 4096);
   $entry=chop($buffer);
   if (($entry<>'.') and ($entry<>'..') and ($entry<>'')) {
 // do your stuff on $entry
echo "found $entry<BR>";
 // you may want to use is_dir() to treat only directories (but not . nor ..)
   } // if affichage
  } // while
  $toto=@pclose($d);
?>

and it produced :
found aigle2
found Babou
found bebel
found bin
found blank.html
found discserver
found doc
<snip>
found favicon.ico
found testdir.php // this script
found testprint.bak

So you can see that I have all the directories, all the files...

The instrumented code should work... On Windows platform...

I now copy-pasted the code you tried and I did this (I commented out some parts because of missing functions etc)
<?
$starting_directory='.';
$DEBUGTEST=1;

  $all_dir = array();
if ($DEBUGTEST==1) echo "VGR all_dir[] cleaned<BR>";
if($d_obj = @popen ("dir /ON /B $starting_directory", "r") ) {
if ($DEBUGTEST==1) echo "VGR ok getdir of '$starting_directory'<BR>";
while (!feof ($d_obj)) {
$buffer = fgets($d_obj, 4096);
$this_entry=chop($buffer);
if ($DEBUGTEST==1) echo "VGR entry '$this_entry' found <BR>";
            if ($this_entry != "." && $this_entry != ".." && $this_entry != $thumb_dir) {
if ($DEBUGTEST==1) echo "VGR entry '$this_entry' accepted as candidate<BR>";
                 if(is_dir("$directory_link$this_entry")) {
if ($DEBUGTEST==1) echo "VGR entry '$this_entry' is a directory<BR>";
//                      if (isValidPictureDirectory("$directory_link$this_entry")) {
//if ($DEBUGTEST==1) echo "VGR entry '$this_entry' passed isValidPictureDirectory, added to all_dir<BR>";
//
//                           $all_dir[] = $this_entry;
//                      }
                 }
                 if (is_file("$directory_link$this_entry")) {
if ($DEBUGTEST==1) echo "VGR entry '$this_entry' is a file<BR>";
//                      if (isValidPictureFile("$directory_link$this_entry")) { // CHECK TEST
//if ($DEBUGTEST==1) echo "VGR entry '$this_entry' is valid picture file<BR>";
//                           $is_picture_directory=true;
//                      }
                 }    
            }
       }
$toto=@pclose($d_obj);
if ($DEBUGTEST==1) echo "VGR end of directories search, ".count($all_dir)." elements found.<BR>";
  } else {
       echo "Error!  Couldn't list directory $starting_directory for some reason!<br />";
       exit;
  }
?>

And it produced... WHAT I WAS EXPECTING :

VGR all_dir[] cleaned
VGR ok getdir of '.'
VGR entry 'aigle2' found
VGR entry 'aigle2' accepted as candidate
VGR entry 'aigle2' is a directory
VGR entry 'Babou' found
VGR entry 'Babou' accepted as candidate
VGR entry 'Babou' is a directory
VGR entry 'bebel' found
VGR entry 'bebel' accepted as candidate
VGR entry 'bebel' is a directory
VGR entry 'bedes' found
VGR entry 'bedes' accepted as candidate
VGR entry 'bedes' is a directory
VGR entry 'bin' found
VGR entry 'bin' accepted as candidate
VGR entry 'bin' is a directory
VGR entry 'blank.html' found
VGR entry 'blank.html' accepted as candidate
VGR entry 'blank.html' is a file
<snip>
VGR entry '' found
VGR end of directories search, 0 elements found. // that's normal, I commented out the filling in of $all_dir[]


IT WORKS !!!
So My guess is that there are no files in your current ('.') directory...

Have you chdir()-ed ?
Avatar of archker

ASKER

there's alot of files in my current dir, 18 or so...

chkdir()-ed???? what?
Avatar of archker

ASKER

=)
you know what, I have my site on a unix platform...
ASKER CERTIFIED SOLUTION
Avatar of VGR
VGR

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of archker

ASKER

$directory2 ...?
it's the PHP variable.
Just put '.' for your testing purposes
start with :
ls -ltra .

and expand from that with reading "man ls"
Avatar of archker

ASKER

...hihi...

IT WORKED!!!!!!!!!!!
changed it to: ls -t $starting_directory

thank you!
Let me just say that if you had not answered "Alright, that worked somewhat good, but, maybe I should have been more specific" to my first posting with "DIR /OD", I would have understood that you were not on Windows :D

I think I merited my points on this one question :/
just change this line and you are done :
$DEBUGTEST=0;
Avatar of archker

ASKER

hehe... well... thats life...
Avatar of archker

ASKER

thanks for not giving up =)