• 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: How to enumerate directory contents?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to enumerate directory contents?


  • Subject: Re: How to enumerate directory contents?
  • From: Paul Archibald <email@hidden>
  • Date: Thu, 21 Aug 2008 10:05:10 -0700

You make a valid point. I think I will make that change.

This is not really what we actually do. I cut out most of the real code to keep the example simple. The actual files we are looking for are machine generated, and the user is not really involved in the process at this point.

Paul


On Aug 21, 2008, at 9:49 AM, Sean McBride wrote:

On 8/21/08 7:46 AM, Paul Archibald said:

	NSString *file;
	// Get all of the files in the source directory, loop thru them.
	NSEnumerator *files = [[myFileMgr
directoryContentsAtPath:srcDirectory] objectEnumerator];
	while(file = [files nextObject] ) {
		if( [[file pathExtension] isEqualToString:interestingExtension] ) {
			// do something with file
		}

You might want to read the docs for "isEqualToString". Using it to compare file extensions will not behave as the user expects (case sensitivity, Unicode decomposition, etc.)

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada




_______________________________________________

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: 
 >Re: How to enumerate directory contents? (From: Paul Archibald <email@hidden>)
 >Re: How to enumerate directory contents? (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Re: NSWindowController, owner, "primary window"...
  • Next by Date: Re: !foo vs foo == nil
  • Previous by thread: Re: How to enumerate directory contents?
  • Next by thread: Problem redirecting NSLog() output to stderr
  • Index(es):
    • Date
    • Thread