• 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
paths for contents of a directory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

paths for contents of a directory


  • Subject: paths for contents of a directory
  • From: Roland Silver <email@hidden>
  • Date: Mon, 14 May 2007 22:32:53 -0600

Given a string directoryPath which is a path to a directory, is there some simple way to iterate over the members of the directory which yields not just the file name of the member, but its complete path name?

With this code:
NSArray* directoryContents =
[[NSFileManager defaultManager] directoryContentsAtPath:directoryPath];
NSString* path;
NSEnumerator *enumerator = [directoryContents objectEnumerator];
while (path = [enumerator nextObject]) {
...
}
the variable "path" (surprisingly) is bound to the file names of the successive entries of the directory, rather than to their path names -- which are what I need to extract the contents of the files in the directory.




_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: paths for contents of a directory
      • From: Eric Jutras <email@hidden>
  • Prev by Date: Re: Custom NSCell Editing Question
  • Next by Date: Re: paths for contents of a directory
  • Previous by thread: Re: Out-of-bounds error when removing entry from NSForm
  • Next by thread: Re: paths for contents of a directory
  • Index(es):
    • Date
    • Thread