<!--
{
  "availability" : [
    "iOS: 2.0.0 - 7.0.0",
    "iPadOS: 2.0.0 - 7.0.0",
    "tvOS: 9.0.0 - 9.0.0",
    "visionOS: 1.0.0 - 1.0.0",
    "watchOS: 2.0.0 - 2.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFURLGetFSRef(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFURLGetFSRef"
  },
  "title" : "CFURLGetFSRef(_:_:)"
}
-->

# CFURLGetFSRef(_:_:)

Converts a given URL to a file or directory object.

```
func CFURLGetFSRef(_ url: CFURL!, _ fsRef: OpaquePointer!) -> Bool
```

## Parameters

`url`

The `CFURL` object to convert to a file or directory object.

`fsRef`

Upon return, contains the file or directory object representing `url`.

## Return Value

`true` if the conversion was successful, otherwise `false`.

## Discussion

The function cannot create an `FSRef` object if any of the leading path parts specified by `url` is an alias. The function can, however, traverse symbolic links.

---

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)