---
title: "CFURLGetFSRef(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfurlgetfsref(_:_:)"
---

# CFURLGetFSRef(_:_:)

Converts a given URL to a file or directory object.

## Declaration

```swift
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

Return Value true if the conversion was successful, otherwise false.

## Discussion

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.

## See Also

### Converting URLs to Other Representations

- [CFURLCreateData(_:_:_:_:)](corefoundation/cfurlcreatedata(_:_:_:_:).md)
- [CFURLCreateStringByAddingPercentEscapes(_:_:_:_:_:)](corefoundation/cfurlcreatestringbyaddingpercentescapes(_:_:_:_:_:).md)
- [CFURLCreateStringByReplacingPercentEscapes(_:_:_:)](corefoundation/cfurlcreatestringbyreplacingpercentescapes(_:_:_:).md)
- [CFURLCreateStringByReplacingPercentEscapesUsingEncoding(_:_:_:_:)](corefoundation/cfurlcreatestringbyreplacingpercentescapesusingencoding(_:_:_:_:).md)
- [CFURLGetFileSystemRepresentation(_:_:_:_:)](corefoundation/cfurlgetfilesystemrepresentation(_:_:_:_:).md)
- [CFURLGetString(_:)](corefoundation/cfurlgetstring(_:).md)
