---
title: "CFURLDestroyResource(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfurldestroyresource(_:_:)"
---

# CFURLDestroyResource(_:_:)

Destroys a resource indicated by a given URL.

## Declaration

```swift
func CFURLDestroyResource(_ url: CFURL!, _ errorCode: UnsafeMutablePointer<Int32>!) -> Bool
```

## Parameters

- `url`: The CFURL object of the resource to destroy.
- `errorCode`: On return, 0 if successful, otherwise an error code indicating the nature of the problem. See doc://com.apple.corefoundation/documentation/CoreFoundation/CFURLError for a list of possible error codes.

## Return Value

Return Value true if successful, false otherwise.

## Discussion

Discussion If url uses an http scheme, an http DELETE request is sent to the resource. If url uses a file scheme, then: if the reference is a file, the file is deleted; if the reference is a directory and the directory is empty, the directory is deleted; if the reference is a directory and the directory is not empty, the function returns false and errorCode contains kCFURLUnknownError.

## See Also

### Core Foundation URL Access Utilities Miscellaneous Functions

- [CFURLCreateDataAndPropertiesFromResource(_:_:_:_:_:_:)](corefoundation/cfurlcreatedataandpropertiesfromresource(_:_:_:_:_:_:).md)
- [CFURLCreatePropertyFromResource(_:_:_:_:)](corefoundation/cfurlcreatepropertyfromresource(_:_:_:_:).md)
- [CFURLWriteDataAndPropertiesToResource(_:_:_:_:)](corefoundation/cfurlwritedataandpropertiestoresource(_:_:_:_:).md)
