Protocol

NSFileManagerDelegate

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

Overview

The NSFileManagerDelegate protocol defines optional methods for managing operations involving the copying, moving, linking, or removal of files and directories. When you use an NSFileManager 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 or NSString objects. The file manager always prefers methods that take an NSURL object over those that take an NSString object.

You should associate your delegate with a unique instance of the NSFileManager class, as opposed to the shared instance.

Topics

Moving an Item

fileManager:shouldMoveItemAtURL:toURL:

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

fileManager:shouldMoveItemAtPath:toPath:

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

fileManager:shouldProceedAfterError:movingItemAtURL:toURL:

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:

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:

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

fileManager:shouldCopyItemAtPath:toPath:

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

fileManager:shouldProceedAfterError:copyingItemAtURL:toURL:

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:

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:

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

fileManager:shouldRemoveItemAtPath:

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

fileManager:shouldProceedAfterError:removingItemAtURL:

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

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:

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

fileManager:shouldLinkItemAtPath:toPath:

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

fileManager:shouldProceedAfterError:linkingItemAtURL:toURL:

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:

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

Relationships

Inherits From

See Also

File System Operations

NSFileManager

An object that provides a convenient interface to the contents of the file system.