like
function open_dir() { if(is_dir($my_dir)) { open_dir(); } else { // read files here }
}
basically you're saying... I'm reading the top level directory, are you a file? ok I'll read you, are you a directory? ok I'll open you up and read your files, and it continues until all files are read. You can stored the data into an associative array and you can use that array later to generate your data. hope that helps, if not google recursive functions
Jim
Ashley M. Kirchner wrote:
A file system question for you folks.
We have a folder that contains the following structure of files for each of our sales reps in the company:
$TOP_FOLDER$/ /$SalesRep1/ /$Client1/ /File1.ext /$Client2/ /File1.ext /File2.ext /$SalesRep2/ /$Client1/ /File1.ext /$Client2/ /File1.ext /File2.ext /$Client3/ /File1.ext /File2.ext /File3.ext etc., etc.
What I'd like to do it iterate through this $TOP_FOLDER$ and generate a page that looks as follows:
$SalesRep1 Clients: 2 Files: 3 Total size: xxx [MB/GB] $SalesRep2 Clients: 3 Files: 6 Total size: xxx [MB/GB] etc., etc.
So I need to traverse through all the directories, while counting stuff at the same time (ignoring . and .. as I go) and at the end do some pretty display of all the information (I can figure that out later, I just need to collect data right now.)
Right now, when I do an opendir() and readdir() I only get the contents of the top folder. How do I get the rest, and count the data as well?
-- A
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php