<!--
{
  "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/Bundle/paths(forResourcesOfType:inDirectory:)-swift.type.method",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSBundle(cm)pathsForResourcesOfType:inDirectory:"
  },
  "title" : "paths(forResourcesOfType:inDirectory:)"
}
-->

# paths(forResourcesOfType:inDirectory:)

Returns an array containing the pathnames for all bundle resources having the specified extension and residing in the bundle directory at the specified path.

```
class func paths(forResourcesOfType ext: String?, inDirectory bundlePath: String) -> [String]
```

## Parameters

`ext`

The filename extension of the files to locate.

    If you specify an empty string or     `nil`    , the extension is assumed not to exist and all of the files in     `bundlePath`     are returned.

`bundlePath`

The top-level directory of a bundle. This must represent a valid path.

## Return Value

An array containing the full pathnames for all bundle resources with the specified extension. This method returns an empty array if no matching resource files are found. It also returns an empty array if the bundle specified by the `bundlePath` parameter does not exist or is not a readable directory.

## Discussion

This method provides a means for dynamically discovering multiple bundle resources of the same type. For details on how localized resources are found, read [The Bundle Search Pattern](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/AccessingaBundlesContents/AccessingaBundlesContents.html#//apple_ref/doc/uid/10000123i-CH104-SW7) in [Bundle Programming Guide](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/Introduction/Introduction.html#//apple_ref/doc/uid/10000123i).

> Note:
> This method is best suited only for the occasional retrieval of resource files. In most cases where you need to retrieve bundle resources, it is preferable to use the `NSBundle` instance methods instead.

## See Also

[`-  localizedStringForKey:value:table:`](/documentation/Foundation/Bundle/localizedString(forKey:value:table:))

Returns a localized version of the string designated by the specified key and residing in the specified table.



---

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)