---
title: "createSymbolicLink(atPath:withDestinationPath:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/filemanager/createsymboliclink(atpath:withdestinationpath:)"
---

# createSymbolicLink(atPath:withDestinationPath:)

Creates a symbolic link that points to the specified destination.

## Declaration

```swift
func createSymbolicLink(atPath path: String, withDestinationPath destPath: String) throws
```

## Parameters

- `path`: The path at which to create the new symbolic link. The last path component is used as the name of the link.
- `destPath`: The path that contains the item to be pointed to by the link. In other words, this is the destination of the link.

## Discussion

Discussion This method does not traverse symbolic links contained in destPath, making it possible to create symbolic links to locations that do not yet exist. Also, if the final path component in path is a symbolic link, that link is not followed. note: In Swift, this method returns Void and is marked with the throws keyword to indicate that it throws an error in cases of failure. You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.

## See Also

### Related Documentation

- [removeItem(atPath:)](foundation/filemanager/removeitem(atpath:).md)

### Creating symbolic and hard links

- [createSymbolicLink(at:withDestinationURL:)](foundation/filemanager/createsymboliclink(at:withdestinationurl:).md)
- [linkItem(at:to:)](foundation/filemanager/linkitem(at:to:).md)
- [linkItem(atPath:toPath:)](foundation/filemanager/linkitem(atpath:topath:).md)
- [destinationOfSymbolicLink(atPath:)](foundation/filemanager/destinationofsymboliclink(atpath:).md)
