note 10715 deleted from function.readdir by hholzgra
| From: | hholzgra@php.net | Date: | Sun, 06 Aug 2006 11:56:08 +0000 |
| Subject: | note 10715 deleted from function.readdir by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-115585@lists.php.net to get a copy of this message | ||
Note Submitter: corbeau at iname dot com
----
SIMPLE SOLUTION:
I spent a while trying to figure out how the looping and recursion would work... then I just wrote
this.
The simplistic way to get files recursively:
$dir="/directory/";
$a =
find $dir -depth -type f -print;
$files = explode ("\n", $a);
Puts all the files into an array.
Do a basename() on each element to get the file name, and a dirname() to get the directory name.
Viola!