<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/FileManager/DirectoryEnumerator",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDirectoryEnumerator"
  },
  "title" : "FileManager.DirectoryEnumerator"
}
-->

# FileManager.DirectoryEnumerator

An object that enumerates the contents of a directory.

```
class DirectoryEnumerator
```

## Overview

You obtain a directory enumerator using [`FileManager`](/documentation/Foundation/FileManager)’s [`enumerator(atPath:)`](/documentation/Foundation/FileManager/enumerator(atPath:)) method. The enumeration provides the pathnames of all files and directories contained within that directory. These pathnames are relative to the directory.

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.

## Topics

### Getting File and Directory Attributes

[`directoryAttributes`](/documentation/Foundation/FileManager/DirectoryEnumerator/directoryAttributes)

A dictionary with the attributes of the directory at which enumeration started.

[`fileAttributes`](/documentation/Foundation/FileManager/DirectoryEnumerator/fileAttributes)

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

[`level`](/documentation/Foundation/FileManager/DirectoryEnumerator/level)

The number of levels deep the current object is in the directory hierarchy being enumerated.

### Skipping Subdirectories

[`-  skipDescendents`](/documentation/Foundation/FileManager/DirectoryEnumerator/skipDescendents())

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

[`-  skipDescendants`](/documentation/Foundation/FileManager/DirectoryEnumerator/skipDescendants())

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

## Relationships

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSFastEnumeration`](/documentation/Foundation/NSFastEnumeration)

[`Sequence`](/documentation/Swift/Sequence)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`Sendable`](/documentation/Swift/Sendable)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`CVarArg`](/documentation/Swift/CVarArg)

### Inherits From

[`NSEnumerator`](/documentation/Foundation/NSEnumerator)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)