---
title: "createSymbolicLink(named:inDirectory:attributes:linkContents:replyHandler:)"
framework: fskit
role: symbol
role_heading: Instance Method
path: "fskit/fsvolume/operations/createsymboliclink(named:indirectory:attributes:linkcontents:replyhandler:)"
---

# createSymbolicLink(named:inDirectory:attributes:linkContents:replyHandler:)

Creates a new symbolic link.

## Declaration

```swift
func createSymbolicLink(named name: FSFileName, inDirectory directory: FSItem, attributes newAttributes: FSItem.SetAttributesRequest, linkContents contents: FSFileName, replyHandler reply: @escaping @Sendable (FSItem?, FSFileName?, (any Error)?) -> Void)
```

```swift
func createSymbolicLink(named name: FSFileName, inDirectory directory: FSItem, attributes newAttributes: FSItem.SetAttributesRequest, linkContents contents: FSFileName) async throws -> (FSItem, FSFileName)
```

## Parameters

- `name`: The new item’s name.
- `directory`: The directory in which to create the item.
- `newAttributes`: Attributes to apply to the new item.
- `contents`: The contents of the new symbolic link.
- `reply`: A block or closure to indicate success or failure. If creation succeeds, pass the newly-created doc://FSKit/documentation/FSKit/FSItem and a nil error. If creation fails, pass the relevant error as the second parameter; FSKit ignores any doc://FSKit/documentation/FSKit/FSItem in this case. For an async Swift implementation, there’s no reply handler; simply return the doc://FSKit/documentation/FSKit/FSItem or throw an error.

## Discussion

Discussion If an item named name already exists in the directory indicated by directory, complete the request with an error with a domain of NSPOSIXErrorDomain and a code of EEXIST.
