Re: Indexing/Directory Enumeration
Re: Indexing/Directory Enumeration
- Subject: Re: Indexing/Directory Enumeration
- From: Matt Neuburg <email@hidden>
- Date: Thu, 24 Feb 2005 09:02:26 -0800
On Wed, 23 Feb 2005 16:16:57 -0600, Justin Spahr-Summers
<email@hidden> said:
>He has multiple recursive directories, in which case a simple
>NSDirectoryEnumerator wouldn't work, as it would only give the
>contents of the directory you specify.
"An enumeration is recursive, including the files of all subdirectories." In
other words, an NSDirectoryEnumerator does recurse, and indeed, one of the
problems with it is getting it *not* to recurse (in case you wanted to fill
your data structure recursively). m.
>On Wed, 23 Feb 2005 09:46:02 -0800, Matt Neuburg <email@hidden> wrote:
>> On Tue, 22 Feb 2005 19:46:25 -0500, Austin Sarner <email@hidden>
>> said:
>>
>> >I'm pretty sure I will need to use an NSDirectoryEnumerator to go
>> >through them all and create the objects and make the arrays to
>> >represent it. Is this the right approach? And if so, can you give me
>> >a nudge in the right direction.
>>
>> NSFileManager* dfm = [NSFileManager defaultManager];
>> NSDirectoryEnumerator* e = [dfm enumeratorAtPath: folder];
>> NSString* aFile;
>> while ((aFile = [e nextObject])) {
>> // add an entry to your data structure
>> }
>>
>> m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden