Mac Developer Library

Developer

Foundation Framework Reference NSDirectoryEnumerator Class Reference

Options
Deployment Target:

On This Page
Language:

NSDirectoryEnumerator

Inheritance


Conforms To


Import Statement


Swift

import Foundation

Objective-C

@import Foundation;

Availability


Available in OS X v10.0 and later.

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.

  • A dictionary with the attributes of the directory at which enumeration started. (read-only)

    Declaration

    Swift

    var directoryAttributes: [NSObject : AnyObject]? { get }

    Objective-C

    @property(readonly, copy) NSDictionary *directoryAttributes

    Discussion

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

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.0 and later.

    See Also

    createDirectoryAtPath:attributes: (NSFileManager)

  • A dictionary with the attributes of the most recently returned file or subdirectory (as referenced by the pathname). (read-only)

    Declaration

    Swift

    var fileAttributes: [NSObject : AnyObject]? { get }

    Objective-C

    @property(readonly, copy) NSDictionary *fileAttributes

    Discussion

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

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • level level Property

    The number of levels deep the current object is in the directory hierarchy being enumerated. (read-only)

    Declaration

    Swift

    var level: Int { get }

    Objective-C

    @property(readonly) NSUInteger level

    Discussion

    The number of levels, with the directory passed to enumeratorAtURL:includingPropertiesForKeys:options:errorHandler: (NSFileManager) considered to be level 0.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.6 and later.

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

    Declaration

    Swift

    func skipDescendents()

    Objective-C

    - (void)skipDescendents

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    func skipDescendants()

    Objective-C

    - (void)skipDescendants

    Discussion

    This method is identical to skipDescendents except for the spelling.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.6 and later.