---
title: "fileManager(_:shouldCopyItemAt:to:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/filemanagerdelegate/filemanager(_:shouldcopyitemat:to:)"
---

# fileManager(_:shouldCopyItemAt:to:)

Asks the delegate if the file manager should copy the specified item to the new URL.

## Declaration

```swift
optional func fileManager(_ fileManager: FileManager, shouldCopyItemAt srcURL: URL, to dstURL: URL) -> Bool
```

## Parameters

- `fileManager`: The file manager object that is attempting to copy the file or directory.
- `srcURL`: The URL of the file or directory that the file manager wants to copy.
- `dstURL`: The URL specifying the location for the copied file or directory.

## Return Value

Return Value true if the item should be copied or false if the file manager should stop copying items associated with the current operation. If you do not implement this method, the file manager assumes a response of true.

## Discussion

Discussion This method is called once for each item that needs to be copied. Thus, for a directory, this method is called once for the directory and once for each item in the directory. This method performs the same task as the fileManager(_:shouldCopyItemAtPath:toPath:) method and is preferred over that method in macOS 10.6 and later.

## See Also

### Related Documentation

- [copyItem(atPath:toPath:)](foundation/filemanager/copyitem(atpath:topath:).md)
- [copyItem(at:to:)](foundation/filemanager/copyitem(at:to:).md)

### Copying  an Item

- [fileManager(_:shouldCopyItemAtPath:toPath:)](foundation/filemanagerdelegate/filemanager(_:shouldcopyitematpath:topath:).md)
- [fileManager(_:shouldProceedAfterError:copyingItemAt:to:)](foundation/filemanagerdelegate/filemanager(_:shouldproceedaftererror:copyingitemat:to:).md)
- [fileManager(_:shouldProceedAfterError:copyingItemAtPath:toPath:)](foundation/filemanagerdelegate/filemanager(_:shouldproceedaftererror:copyingitematpath:topath:).md)
