---
title: "CFBundleCopyResourceURLInDirectory(_:_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfbundlecopyresourceurlindirectory(_:_:_:_:)"
---

# CFBundleCopyResourceURLInDirectory(_:_:_:_:)

Returns the location of a resource contained in the specified bundle directory without requiring the creation of a CFBundle object.

## Declaration

```swift
func CFBundleCopyResourceURLInDirectory(_ bundleURL: CFURL!, _ resourceName: CFString!, _ resourceType: CFString!, _ subDirName: CFString!) -> CFURL!
```

## Parameters

- `bundleURL`: The bundle to examine.
- `resourceName`: The name of the requested resource.
- `resourceType`: The abstract type of the requested resource. The type is expressed as a filename extension, such as jpg. Pass NULL if you don’t need to search by type.
- `subDirName`: The name of the subdirectory of the bundle’s resources directory to search. Pass NULL to search the standard CFBundle resource locations.

## Return Value

Return Value A CFURL object describing the location of the requested resource, or NULL if the resource cannot be found. Ownership follows the The Create Rule.

## Discussion

Discussion This function provides a means to obtain package information for a bundle without first creating a bundle. However, since CFBundle objects cache search results, it is faster to create a CFBundle object if you need to repeatedly access resources. Note that searches are case-sensitive, even on file systems (such as HFS+) that are not case sensitive with regards to file names.

## See Also

### Locating Bundle Resources

- [CFBundleCloseBundleResourceMap(_:_:)](corefoundation/cfbundleclosebundleresourcemap(_:_:).md)
- [CFBundleCopyResourceURL(_:_:_:_:)](corefoundation/cfbundlecopyresourceurl(_:_:_:_:).md)
- [CFBundleCopyResourceURLsOfType(_:_:_:)](corefoundation/cfbundlecopyresourceurlsoftype(_:_:_:).md)
- [CFBundleCopyResourceURLsOfTypeInDirectory(_:_:_:)](corefoundation/cfbundlecopyresourceurlsoftypeindirectory(_:_:_:).md)
- [CFBundleCopyResourceURLForLocalization(_:_:_:_:_:)](corefoundation/cfbundlecopyresourceurlforlocalization(_:_:_:_:_:).md)
- [CFBundleCopyResourceURLsOfTypeForLocalization(_:_:_:_:)](corefoundation/cfbundlecopyresourceurlsoftypeforlocalization(_:_:_:_:).md)
- [CFBundleOpenBundleResourceFiles(_:_:_:)](corefoundation/cfbundleopenbundleresourcefiles(_:_:_:).md)
- [CFBundleOpenBundleResourceMap(_:)](corefoundation/cfbundleopenbundleresourcemap(_:).md)
