---
title: "duplicate(_:completionHandler:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsworkspace/duplicate(_:completionhandler:)"
---

# duplicate(_:completionHandler:)

Duplicates the specified URLS asynchronously in the same manner as the Finder.

## Declaration

```swift
func duplicate(_ URLs: [URL], completionHandler handler: (@Sendable ([URL : URL], (any Error)?) -> Void)? = nil)
```

```swift
func duplicate(_ URLs: [URL]) async throws -> [URL : URL]
```

## Parameters

- `URLs`: An array of doc://com.apple.documentation/documentation/Foundation/NSURL objects representing the files to duplicate. This parameter must not be nil.
- `handler`: The completion handler block object to call when the operation completes. You may specify nil for this parameter. If this parameter is not nil, you must call the doc://com.apple.appkit/documentation/AppKit/NSWorkspace/duplicate(_:completionHandler:) method from a block running on an active dispatch queue; your completion handler block is subsequently executed on the same dispatch queue. This block takes two parameters:

## Discussion

Discussion This method may cause a progress indicator, or other user interface element, to be shown by the Finder. In macOS 10.6, this method requires the app to run its main run loop in a common mode. You can safely call this method from any thread of your app.

## See Also

### Manipulating Files

- [recycle(_:completionHandler:)](appkit/nsworkspace/recycle(_:completionhandler:).md)
- [activateFileViewerSelecting(_:)](appkit/nsworkspace/activatefileviewerselecting(_:).md)
- [selectFile(_:inFileViewerRootedAtPath:)](appkit/nsworkspace/selectfile(_:infileviewerrootedatpath:).md)
