• 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: Getting a list of files/folders in a folder/drive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting a list of files/folders in a folder/drive


  • Subject: Re: Getting a list of files/folders in a folder/drive
  • From: Gregory Weston <email@hidden>
  • Date: Fri, 5 Jan 2007 09:01:38 -0500

On Jan 5, 2007, at 8:18 AM, Azza wrote:

This may be a really dumb question, but could someone point me in the
direction of how to enumerate through folders and files on a drive?
I need to build a mini finder into my application but can't seem to work out
what to use!?
[ having looked at NSWorkspace and NSFileManager which both didn't really
lead me anywhere, but I may be wrong ]

You needed to look closer at NSFileManager. One of the sections in "Methods by Task" is "Discovering directory contents."


You can get an array containing the names of the immediate contents of a directory with directoryContentsAtPath:.
You can get an object that lets you iterate through the entire directory tree with enumeratorAtPath:
There's also subpathsAtPath: which returns an array of the whole tree (and seems gratuitous to me).
_______________________________________________


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


  • Prev by Date: Sorted NSTableView's selectedRow
  • Next by Date: Re: Sorted NSTableView's selectedRow
  • Previous by thread: Re: Getting a list of files/folders in a folder/drive
  • Next by thread: Using DirectoryService to Find Users
  • Index(es):
    • Date
    • Thread