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

# fileManager(_:shouldMoveItemAt:to:)

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

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

## Parameters

`fileManager`

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

`srcURL`

The URL of the file or directory that the file manager wants to move.

`dstURL`

The URL specifying the new location for the file or directory.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the item should be moved or <doc://com.apple.documentation/documentation/Swift/false> if it should not be moved. 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 only once for the item being moved, regardless of whether the item is a file, directory, or symbolic link.

This method performs the same task as the [`fileManager(_:shouldMoveItemAtPath:toPath:)`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldMoveItemAtPath:toPath:)) method and is preferred over that method in macOS 10.6 and later.

## See Also

[`-  moveItemAtPath:toPath:error:`](/documentation/Foundation/FileManager/moveItem(atPath:toPath:))

Moves the file or directory at the specified path to a new location synchronously.

[`-  moveItemAtURL:toURL:error:`](/documentation/Foundation/FileManager/moveItem(at:to:))

Moves the file or directory 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)