On Sunday 28 October 2007 01:32:15 you wrote:
> On 10/27/07, Børge Holen <[EMAIL PROTECTED]> wrote:
> > I'm currently using RecursiveDirectoryIterator and
> > RecursiveIteratorIterator.
> > I'm using fwrite to write to a file while parsing throught the file
> > structure,
> > and was wondering if it is at all possible to sort alphabetical without
> > going
> > all array. That seems to me like doing the job twice over. Atleast part
> > of it...
>
> how are you doing the sorting part?
> can you show us some of your code ?
thats the problem, i don't know how to sort before read starts, that came out
a bit wrong. I need to read the filesystem alphabeticly.
I could use the system command 'find somepath' and then use '| sort'
witch was part of my old stuff with a ton of waste code.
or I could 'sort array' witch of course forces me to create an array to loop
around and push at each folder and leaf.
I found this code at php.net witch needs very little modifications and can do
so much, but I can't figure out how to make it read alphabeticly as mentioned
$it = new RecursiveDirectoryIterator($_GET['location']);
foreach (new RecursiveIteratorIterator($it, 2) as $path){
if($path->isDir()){
// writing to some static file
}elseif(some unfinished statement){
fwrite($dynfile, "$path\n");
}else{
// writing to some static file
}
}
I just... nothings keeping me from sorting the the dynfile after writing, but
also that seems to do the job twice instead of doing it correct the first
time.
>
> -nathan
--
---
Børge Holen
http://www.arivene.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php