Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Lista plikow w katalogu po dacie modyfikacji
Aven
post 18.06.2003, 14:27:33
Post #1





Grupa: Zarejestrowani
Postów: 25
Pomógł: 0
Dołączył: 24.05.2003
Skąd: Łódź

Ostrzeżenie: (0%)
-----


Mam sredni problemik ...
Potrzebuje liste plików z okreslonego katalogu, uporządkowanych w kolejności od daty ostatniej modyfikacji ( filecdate() albo filemtime() )

funkcja get_directory_file($path) wedlug Petera Mouldinga smile.gif zwraca tablice z nazwami plikow. Kwestia jej posortowania. Czy moge liczyc na jakas podpowiedz ?!?
Kod
function get_directory_file($path)

   {

   $path_id = opendir($path);

   while($file_name = readdir($path_id))

      {

      if($file_name != "." and $file_name != "..")

         {

         $file["type"] = filetype($path . "/" . $file_name);

         if($file["type"] == "dir")

            {

            $file_array = get_directory_file($path . "/"

               . $file_name);

            if(isset($found))

               {

               $found = array_merge($found, $file_array);

               }

            else

               {

               $found = $file_array;

               }

            }

         else

            {

            $file["changed"] = filectime($path . "/" . $file_name);

            $file["accessed"] = fileatime($path . "/" . $file_name);

            $file["group"] = filegroup($path . "/" . $file_name);

            $file["inode"] = fileinode($path . "/" . $file_name);

            $file["modified"] = filemtime($path . "/" . $file_name);

            $file["owner"] = fileowner($path . "/" . $file_name);

            $file["permissions"] = fileperms($path . "/" . $file_name);

            $file["size"] = filesize($path . "/" . $file_name);

            $found[$path][$file_name] = $file;

            }

         }

      }

   closedir($path_id);

   if(!isset($found))

      {

      $found = array();

      }

   return($found);

}


pozdrawiam i licze na to ze ktos mi :arrow: pomoze.


-------------------------------
temat nie na PRO (DeyV)


--------------------
------
aven
Go to the top of the page
+Quote Post
Cudi
post 18.06.2003, 14:58:14
Post #2


Administrator planeta/IRC


Grupa: Przyjaciele php.pl
Postów: 385
Pomógł: 0
Dołączył: 19.04.2003
Skąd: Zabrze

Ostrzeżenie: (0%)
-----


Wystarczy array_multisort, pobierasz tablice za pomocą swojej funkcji, następnie tworzysz nową zawierającą tylko element 'modified' każdego pliku z poprzedniej i potem wrzucasz obie w array_multisorta z odpowiednimi parametrami (w manualu jest wszystko opisane).


--------------------
"Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning."
Cudi's devBlog
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 18.07.2025 - 16:24