<!--
{
  "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",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(pl)NSFileManagerDelegate"
  },
  "title" : "FileManagerDelegate"
}
-->

# FileManagerDelegate

The interface a file manager’s delegate uses to intervene during operations or if an error occurs.

```
protocol FileManagerDelegate : NSObjectProtocol
```

## Overview

The [`FileManagerDelegate`](/documentation/Foundation/FileManagerDelegate) protocol defines optional methods for managing operations involving the copying, moving, linking, or removal of files and directories. When you use an [`FileManager`](/documentation/Foundation/FileManager) object to initiate a copy, move, link, or remove operation, the file manager asks its delegate whether the operation should begin at all and whether it should proceed when an error occurs.

The methods of this protocol accept either [`NSURL`](/documentation/Foundation/NSURL) or [`NSString`](/documentation/Foundation/NSString) objects. The file manager always prefers methods that take an [`NSURL`](/documentation/Foundation/NSURL) object over those that take an [`NSString`](/documentation/Foundation/NSString) object.

You should associate your delegate with a unique instance of the [`FileManager`](/documentation/Foundation/FileManager) class, as opposed to the shared instance.

## Topics

### Moving  an Item

[`-  fileManager:shouldMoveItemAtURL:toURL:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldMoveItemAt:to:))

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

[`-  fileManager:shouldMoveItemAtPath:toPath:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldMoveItemAtPath:toPath:))

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

[`-  fileManager:shouldProceedAfterError:movingItemAtURL:toURL:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldProceedAfterError:movingItemAt:to:))

Asks the delegate if the move operation should continue after an error occurs while moving the item at the specified URL.

[`-  fileManager:shouldProceedAfterError:movingItemAtPath:toPath:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldProceedAfterError:movingItemAtPath:toPath:))

Asks the delegate if the move operation should continue after an error occurs while moving the item at the specified path.

### Copying  an Item

[`-  fileManager:shouldCopyItemAtURL:toURL:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldCopyItemAt:to:))

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

[`-  fileManager:shouldCopyItemAtPath:toPath:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldCopyItemAtPath:toPath:))

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

[`-  fileManager:shouldProceedAfterError:copyingItemAtURL:toURL:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldProceedAfterError:copyingItemAt:to:))

Asks the delegate if the move operation should continue after an error occurs while copying the item at the specified URL.

[`-  fileManager:shouldProceedAfterError:copyingItemAtPath:toPath:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldProceedAfterError:copyingItemAtPath:toPath:))

Asks the delegate if the move operation should continue after an error occurs while copying the item at the specified path.

### Removing an Item

[`-  fileManager:shouldRemoveItemAtURL:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldRemoveItemAt:))

Asks the delegate whether the item at the specified URL should be deleted.

[`-  fileManager:shouldRemoveItemAtPath:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldRemoveItemAtPath:))

Asks the delegate whether the item at the specified path should be deleted.

[`-  fileManager:shouldProceedAfterError:removingItemAtURL:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldProceedAfterError:removingItemAt:))

Asks the delegate if the operation should continue after an error occurs while removing the item at the specified URL.

[`-  fileManager:shouldProceedAfterError:removingItemAtPath:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldProceedAfterError:removingItemAtPath:))

Asks the delegate if the operation should continue after an error occurs while removing the item at the specified path.

### Linking an Item

[`-  fileManager:shouldLinkItemAtURL:toURL:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldLinkItemAt:to:))

Asks the delegate if a hard link should be created between the items at the two URLs.

[`-  fileManager:shouldLinkItemAtPath:toPath:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldLinkItemAtPath:toPath:))

Asks the delegate if a hard link should be created between the items at the two paths.

[`-  fileManager:shouldProceedAfterError:linkingItemAtURL:toURL:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldProceedAfterError:linkingItemAt:to:))

Asks the delegate if the operation should continue after an error occurs while linking to the item at the specified URL.

[`-  fileManager:shouldProceedAfterError:linkingItemAtPath:toPath:`](/documentation/Foundation/FileManagerDelegate/fileManager(_:shouldProceedAfterError:linkingItemAtPath:toPath:))

Asks the delegate if the operation should continue after an error occurs while linking to the item at the specified path.

## Relationships

### Inherits From

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

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)