<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldCopyItemAtPath:toPath:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(pl)NSFileManagerDelegate(im)fileManager:shouldCopyItemAtPath:toPath:"
  },
  "title" : "fileManager(_:shouldCopyItemAtPath:toPath:)"
}
-->

# fileManager(_:shouldCopyItemAtPath:toPath:)

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

```
optional func fileManager(_ fileManager: FileManager, shouldCopyItemAtPath srcPath: String, toPath dstPath: String) -> Bool
```

## Parameters

`fileManager`

The file manager object that is attempting to copy the file or directory.

`srcPath`

The path to the file or directory that the file manager wants to copy.

`dstPath`

The new path for the copied file or directory.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the item should be copied or <doc://com.apple.documentation/documentation/Swift/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 <doc://com.apple.documentation/documentation/Swift/true>.

## 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(_:shouldCopyItemAt:to:)`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldCopyItemAt:to:)) method, which is preferred over this method in macOS 10.6 and later.

## See Also

[`copyItem(atPath:toPath:)`](/documentation/Foundation/FileManager/copyItem(atPath:toPath:))

Copies the item at the specified path to a new location synchronously.

[`copyItem(at:to:)`](/documentation/Foundation/FileManager/copyItem(at:to:))

Copies the file at the specified URL to a new location synchronously.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)