---
title: "CFURLCreateCopyDeletingLastPathComponent(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfurlcreatecopydeletinglastpathcomponent(_:_:)"
---

# CFURLCreateCopyDeletingLastPathComponent(_:_:)

Creates a copy of a given URL with the last path component deleted.

## Declaration

```swift
func CFURLCreateCopyDeletingLastPathComponent(_ allocator: CFAllocator!, _ url: CFURL!) -> CFURL!
```

## Parameters

- `allocator`: The allocator to use to allocate memory for the new CFURL object. Pass NULL or doc://com.apple.corefoundation/documentation/CoreFoundation/kCFAllocatorDefault to use the current default allocator.
- `url`: The CFURL object whose last path component you want to delete.

## Return Value

Return Value A copy of url with the last path component deleted. Ownership follows the create rule. See The Create Rule.

## See Also

### Creating a CFURL

- [CFURLCopyAbsoluteURL(_:)](corefoundation/cfurlcopyabsoluteurl(_:).md)
- [CFURLCreateAbsoluteURLWithBytes(_:_:_:_:_:_:)](corefoundation/cfurlcreateabsoluteurlwithbytes(_:_:_:_:_:_:).md)
- [CFURLCreateByResolvingBookmarkData(_:_:_:_:_:_:_:)](corefoundation/cfurlcreatebyresolvingbookmarkdata(_:_:_:_:_:_:_:).md)
- [CFURLCreateCopyAppendingPathComponent(_:_:_:_:)](corefoundation/cfurlcreatecopyappendingpathcomponent(_:_:_:_:).md)
- [CFURLCreateCopyAppendingPathExtension(_:_:_:)](corefoundation/cfurlcreatecopyappendingpathextension(_:_:_:).md)
- [CFURLCreateCopyDeletingPathExtension(_:_:)](corefoundation/cfurlcreatecopydeletingpathextension(_:_:).md)
- [CFURLCreateFilePathURL(_:_:_:)](corefoundation/cfurlcreatefilepathurl(_:_:_:).md)
- [CFURLCreateFileReferenceURL(_:_:_:)](corefoundation/cfurlcreatefilereferenceurl(_:_:_:).md)
- [CFURLCreateFromFileSystemRepresentation(_:_:_:_:)](corefoundation/cfurlcreatefromfilesystemrepresentation(_:_:_:_:).md)
- [CFURLCreateFromFileSystemRepresentationRelativeToBase(_:_:_:_:_:)](corefoundation/cfurlcreatefromfilesystemrepresentationrelativetobase(_:_:_:_:_:).md)
- [CFURLCreateFromFSRef(_:_:)](corefoundation/cfurlcreatefromfsref(_:_:).md)
- [CFURLCreateWithBytes(_:_:_:_:_:)](corefoundation/cfurlcreatewithbytes(_:_:_:_:_:).md)
- [CFURLCreateWithFileSystemPath(_:_:_:_:)](corefoundation/cfurlcreatewithfilesystempath(_:_:_:_:).md)
- [CFURLCreateWithFileSystemPathRelativeToBase(_:_:_:_:_:)](corefoundation/cfurlcreatewithfilesystempathrelativetobase(_:_:_:_:_:).md)
- [CFURLCreateWithString(_:_:_:)](corefoundation/cfurlcreatewithstring(_:_:_:).md)
