Next Page > Hide TOC

NSDirectoryEnumerator Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in Mac OS X v10.0 and later.
Companion guide
Declared in
NSFileManager.h
Related sample code

Overview

An NSDirectoryEnumerator object enumerates the contents of a directory, returning the pathnames of all files and directories contained within that directory. These pathnames are relative to the directory.

You obtain a directory enumerator using NSFileManager’s enumeratorAtPath: method. For more details, see Low-Level File Management Programming Topics.

An enumeration is recursive, including the files of all subdirectories, and crosses device boundaries. An enumeration does not resolve symbolic links, or attempt to traverse symbolic links that point to directories.

Tasks

Getting File and Directory Attributes

Skipping Subdirectories

Instance Methods

directoryAttributes

Returns an NSDictionary object that contains the attributes of the directory at which enumeration started.

- (NSDictionary *)directoryAttributes

Return Value

An NSDictionary object that contains the attributes of the directory at which enumeration started.

Discussion

See the description of the fileAttributesAtPath:traverseLink: method of NSFileManager for details on obtaining the attributes from the dictionary.

Availability
See Also
Declared In
NSFileManager.h

fileAttributes

Returns an NSDictionary object that contains the attributes of the most recently returned file or subdirectory (as referenced by the pathname).

- (NSDictionary *)fileAttributes

Return Value

An NSDictionary object that contains the attributes of the most recently returned file or subdirectory (as referenced by the pathname).

Discussion

See the description of the fileAttributesAtPath:traverseLink: method of NSFileManager for details on obtaining the attributes from the dictionary.

Availability
Related Sample Code
Declared In
NSFileManager.h

skipDescendents

Causes the receiver to skip recursion into the most recently obtained subdirectory.

- (void)skipDescendents

Availability
Declared In
NSFileManager.h

Next Page > Hide TOC


© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-10-15)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.