Recursively listing, and storing, directory contents
Posted
by enchilada
on Stack Overflow
See other posts from Stack Overflow
or by enchilada
Published on 2010-06-06T22:37:28Z
Indexed on
2010/06/06
22:42 UTC
Read the original article
Hit count: 328
objective-c
|cocoa
I know how to recursively list directory contents. I will be using Snow Leopard's enumeratorAtURL:includingPropertiesForKeys:options:errorHandler: method to do this.
However I want to store my findings into a object hierarchy (of, say, objects of a custom FileOrDirectory class that has isLeaf, children, and count attributes).
I need to pre-load the directory and file structure into such a object hierarchy, in order to do whatever I want with NSTreeController and whatnot. I guess the trickiest thing here is to get the children attribute correct in the object hierarchy.
Any ideas?
© Stack Overflow or respective owner