• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [Q] Directory & File enumeration order?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] Directory & File enumeration order?


  • Subject: Re: [Q] Directory & File enumeration order?
  • From: JongAm Park <email@hidden>
  • Date: Wed, 20 Jul 2011 14:22:09 -0700

Yeah.. that was what I thought, but I thought "nextObject" is too vague and doing that additional step is too time-consuming, because I need to work on contents in directories in my current project very frequently.

If the NSDirectoryEnumerator supports how the "next" object is to be chosen, it can be great.

Thank you.

On Jul 20, 2011, at 2:12 PM, Evadne Wu wrote:

> Maybe instead of using the directory enumerator, fetch all the contents as an NSArray and sort that?
>
> -ev
>
> On Jul 21, 2011, at 05:09, JongAm Park wrote:
>
>> Hello, I wrote lines of code to enumerate files & folders under a given folder.
>>
>> NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];
>>
>> NSDirectoryEnumerator *directoryEnumerator;
>>
>> NSURL *candidateURL = nil;
>>
>> for( theURL in m_URLs_folders )
>> {
>>  directoryEnumerator = [fileManager enumeratorAtURL:theURL
>> 			    includingPropertiesForKeys:enumerationKey
>> 					       options:enumerationMask
>> 					  errorHandler:nil];
>>
>>  while( candidateURL = [directoryEnumerator nextObject] )
>>  {
>>
>> The order [directoryEnumerator nextObject] gives is :
>>
>> file://localhost/Users/jongampark/Sample Video/Upper/Reel/Clip_0016/Media/Clip_0016_000001.dpx,
>> file://localhost/Users/jongampark/Sample Video/Upper/Reel/Clip_0016/Media/Clip_0016_000002.dpx,
>> file://localhost/Users/jongampark/Sample Video/Upper/Reel/Clip_0016/Media/Clip_0016_000000.dpx
>>
>> How can I make it retrieve in this order?
>>
>> Clip_0016_000000.dpx,
>> Clip_0016_000001.dpx,
>> Clip_0016_000002.dpx,
>>
>> Thank you.
>> JongAm Park
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >[Q] Directory & File enumeration order? (From: JongAm Park <email@hidden>)
 >Re: [Q] Directory & File enumeration order? (From: Evadne Wu <email@hidden>)

  • Prev by Date: Re: [Q] Directory & File enumeration order?
  • Next by Date: CFMutableDictionary Capacity
  • Previous by thread: Re: [Q] Directory & File enumeration order?
  • Next by thread: Re: [Q] Directory & File enumeration order?
  • Index(es):
    • Date
    • Thread