[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: [despammed] Best way to recursive folders?
From:       Mosfet <dan.duley () verizon ! net>
Date:       2003-05-03 14:18:02
[Download RAW message or body]

Hey, that's a good approach - I'll use it! Thank you :)

On Saturday 03 May 2003 02:38 am, Esben Mose Hansen wrote:
> On Saturday 03 May 2003 02:41, Mosfet wrote:
...snip...
>
> You can combine the above approaches: When scanning the first directory, 
> push any directories to a stack. When done with this directory, take the
> top directory and process that in the same way. As this is tail recursion,
> it can be replaced with a simple look. In psedo code, in pseodu C++:
>
> stack<Directories> dirs_to_be_processed;
> do {
> 	for each file in diretory{
> 		if (file is a directory)
> 			dirs_to_be_processed.push(file);
> 		processFile(file);
> 	}
> } while (!.stack.empty())
>
> This kind of approach often works like a charm when you want to rid
> yourself of those nasty recursions :-)
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic