Link to home
Start Free TrialLog in
Avatar of excii
excii

asked on

LISTING FILES FROM DIRECTORY, SORT BY DATE

I have listed files and directories with this script:


$dir = 'folder1';

if ($dhandle = opendir($dir))
{
      while (false !== ($file = readdir($dhandle)))
      {
            if (is_file("$dir/$file"))
            {
                  echo "FILE: " . $file . "<BR>";
            }
            else
            {
                  if($file != "." && $file != "..")
                  {
                        echo "DIR: " . $file . "<BR>";
                  }
            }
      }
      closedir($dhandle);
}


1. But how do I print CreatedDate and ModifiedDate to files & folders?
2. And how do I sort files & folders by CreatedDate or ModifiedDate ?
3. Is somewhere list of functions for all file's 'attributes' like Size, Type, CreatedDate, ModifiedDate, Attributes etc.

Thanks.

Regards,

excii
ASKER CERTIFIED SOLUTION
Avatar of Bech100
Bech100

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 VGR
VGR

1,2,3 : OS-dependent and filesystem dependent

so please tell us your platform and the filesystem of your volumes if on Windows :D
Avatar of excii

ASKER

that worked