<!--
{
  "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/FileManager",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFileManager"
  },
  "title" : "FileManager"
}
-->

# FileManager

A convenient interface to the contents of the file system, and the primary means of interacting with it.

```
class FileManager
```

## Overview

A file manager object lets you examine the contents of the file system and make changes to it. The [`FileManager`](/documentation/Foundation/FileManager) class provides convenient access to a shared file manager object that is suitable for most types of file-related manipulations. A file manager object is typically your primary mode of interaction with the file system. You use it to locate, create, copy, and move files and directories. You also use it to get information about a file or directory or change some of its attributes.

When specifying the location of files, you can use either [`NSURL`](/documentation/Foundation/NSURL) or [`NSString`](/documentation/Foundation/NSString) objects. The use of the [`NSURL`](/documentation/Foundation/NSURL) class is generally preferred for specifying file-system items because URLs can convert path information to a more efficient representation internally. You can also obtain a bookmark from an [`NSURL`](/documentation/Foundation/NSURL) object, which is similar to an alias and offers a more sure way of locating the file or directory later.

If you are moving, copying, linking, or removing files or directories, you can use a delegate in conjunction with a file manager object to manage those operations. The delegate’s role is to affirm the operation and to decide whether to proceed when errors occur. In macOS 10.7 and later, the delegate must conform to the [`FileManagerDelegate`](/documentation/Foundation/FileManagerDelegate) protocol.

In iOS 5.0 and later and in macOS 10.7 and later, [`FileManager`](/documentation/Foundation/FileManager) includes methods for managing items stored in iCloud. Files and directories tagged for cloud storage are synced to iCloud so that they can be made available to the user’s iOS devices and Macintosh computers. Changes to an item in one location are propagated to all other locations to ensure the items stay in sync.

### Sync control

A [package](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/DocumentPackages/DocumentPackages.html#//apple_ref/doc/uid/10000123i-CH106-SW1) is a directory that the system presents as a single file to the person using the device. Apps with documents that contain multiple files can use packages to manage contents like media assets. In iOS 26 and macOS 26 and later, [`FileManager`](/documentation/Foundation/FileManager) introduces methods for controlling how a file provider syncs these items. By pausing sync when your app opens a package and resuming when it closes, your app can prevent the file provider from changing the contents of the package in unexpected ways, which potentially leaves the document in an inconsistent state. You can also use this pause and resume API on regular “flat” files.

### Threading considerations

The methods of the shared [`FileManager`](/documentation/Foundation/FileManager) object can be called from multiple threads safely. However, if you use a delegate to receive notifications about the status of move, copy, remove, and link operations, you should create a unique instance of the file manager object, assign your delegate to that object, and use that file manager to initiate your operations.

## Topics

### Creating a file manager

[`convenience init(authorization: NSWorkspace.Authorization)`](/documentation/Foundation/FileManager/init(authorization:))

Initializes a file manager object that is authorized to perform privileged file system operations.

[`class var `default`: FileManager`](/documentation/Foundation/FileManager/default)

The shared file manager object for the process.

### Accessing user directories

[`var homeDirectoryForCurrentUser: URL`](/documentation/Foundation/FileManager/homeDirectoryForCurrentUser)

The home directory for the current user.

[`func NSHomeDirectory() -> String`](/documentation/Foundation/NSHomeDirectory())

Returns the path to either the user’s or application’s home directory, depending on the platform.

[`func NSUserName() -> String`](/documentation/Foundation/NSUserName())

Returns the logon name of the current user.

[`func NSFullUserName() -> String`](/documentation/Foundation/NSFullUserName())

Returns a string containing the full name of the current user.

[`func homeDirectory(forUser: String) -> URL?`](/documentation/Foundation/FileManager/homeDirectory(forUser:))

Returns the home directory for the specified user.

[`func NSHomeDirectoryForUser(String?) -> String?`](/documentation/Foundation/NSHomeDirectoryForUser(_:))

Returns the path to a given user’s home directory.

[`var temporaryDirectory: URL`](/documentation/Foundation/FileManager/temporaryDirectory)

The temporary directory for the current user.

[`func NSTemporaryDirectory() -> String`](/documentation/Foundation/NSTemporaryDirectory())

Returns the path of the temporary directory for the current user.

### Locating system directories

[`func url(for: FileManager.SearchPathDirectory, in: FileManager.SearchPathDomainMask, appropriateFor: URL?, create: Bool) throws -> URL`](/documentation/Foundation/FileManager/url(for:in:appropriateFor:create:))

Locates and optionally creates the specified common directory in a domain.

[`func urls(for: FileManager.SearchPathDirectory, in: FileManager.SearchPathDomainMask) -> [URL]`](/documentation/Foundation/FileManager/urls(for:in:))

Returns an array of URLs for the specified common directory in the requested domains.

[`func NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory, FileManager.SearchPathDomainMask, Bool) -> [String]`](/documentation/Foundation/NSSearchPathForDirectoriesInDomains(_:_:_:))

Creates a list of directory search paths.

[`func NSOpenStepRootDirectory() -> String`](/documentation/Foundation/NSOpenStepRootDirectory())

Returns the root directory of the user’s system.

### Locating application group container directories

[`func containerURL(forSecurityApplicationGroupIdentifier: String) -> URL?`](/documentation/Foundation/FileManager/containerURL(forSecurityApplicationGroupIdentifier:))

Returns the container directory associated with the specified security application group identifier.

  <doc://com.apple.documentation/documentation/BundleResources/Entitlements/com.apple.security.application-groups>

### Discovering directory contents

[`func contentsOfDirectory(at: URL, includingPropertiesForKeys: [URLResourceKey]?, options: FileManager.DirectoryEnumerationOptions) throws -> [URL]`](/documentation/Foundation/FileManager/contentsOfDirectory(at:includingPropertiesForKeys:options:))

Performs a shallow search of the specified directory and returns URLs for the contained items.

[`func contentsOfDirectory(atPath: String) throws -> [String]`](/documentation/Foundation/FileManager/contentsOfDirectory(atPath:))

Performs a shallow search of the specified directory and returns the paths of any contained items.

[`func enumerator(at: URL, includingPropertiesForKeys: [URLResourceKey]?, options: FileManager.DirectoryEnumerationOptions, errorHandler: ((URL, any Error) -> Bool)?) -> FileManager.DirectoryEnumerator?`](/documentation/Foundation/FileManager/enumerator(at:includingPropertiesForKeys:options:errorHandler:))

Returns a directory enumerator object that can be used to perform a deep enumeration of the directory at the specified URL.

[`- (NSDirectoryEnumerator<NSURL *> *) enumeratorAtURL:(NSURL *) url includingPropertiesForKeys:(NSArray<NSString *> *) keys options:(NSDirectoryEnumerationOptions) mask errorHandler:(BOOL (^)(NSURL *url, NSError *error)) handler;`](/documentation/Foundation/NSFileManager/enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:)

Returns a directory enumerator object that can be used to perform a deep enumeration of the directory at the specified URL.

[`func enumerator(atPath: String) -> FileManager.DirectoryEnumerator?`](/documentation/Foundation/FileManager/enumerator(atPath:))

Returns a directory enumerator object that can be used to perform a deep enumeration of the directory at the specified path.

[`class DirectoryEnumerator`](/documentation/Foundation/FileManager/DirectoryEnumerator)

An object that enumerates the contents of a directory.

[`func mountedVolumeURLs(includingResourceValuesForKeys: [URLResourceKey]?, options: FileManager.VolumeEnumerationOptions) -> [URL]?`](/documentation/Foundation/FileManager/mountedVolumeURLs(includingResourceValuesForKeys:options:))

Returns an array of URLs that identify the mounted volumes available on the device.

[`struct VolumeEnumerationOptions`](/documentation/Foundation/FileManager/VolumeEnumerationOptions)

Options for enumerating mounted volumes with the [`mountedVolumeURLs(includingResourceValuesForKeys:options:)`](/documentation/Foundation/FileManager/mountedVolumeURLs(includingResourceValuesForKeys:options:)) method.

[`func subpathsOfDirectory(atPath: String) throws -> [String]`](/documentation/Foundation/FileManager/subpathsOfDirectory(atPath:))

Performs a deep enumeration of the specified directory and returns the paths of all of the contained subdirectories.

[`func subpaths(atPath: String) -> [String]?`](/documentation/Foundation/FileManager/subpaths(atPath:))

Returns an array of strings identifying the paths for all items in the specified directory.

### Creating and deleting items

[`func createDirectory(at: URL, withIntermediateDirectories: Bool, attributes: [FileAttributeKey : Any]?) throws`](/documentation/Foundation/FileManager/createDirectory(at:withIntermediateDirectories:attributes:))

Creates a directory with the given attributes at the specified URL.

[`func createDirectory(atPath: String, withIntermediateDirectories: Bool, attributes: [FileAttributeKey : Any]?) throws`](/documentation/Foundation/FileManager/createDirectory(atPath:withIntermediateDirectories:attributes:))

Creates a directory with given attributes at the specified path.

[`func createFile(atPath: String, contents: Data?, attributes: [FileAttributeKey : Any]?) -> Bool`](/documentation/Foundation/FileManager/createFile(atPath:contents:attributes:))

Creates a file with the specified content and attributes at the given location.

[`func removeItem(at: URL) throws`](/documentation/Foundation/FileManager/removeItem(at:))

Removes the file or directory at the specified URL.

[`func removeItem(atPath: String) throws`](/documentation/Foundation/FileManager/removeItem(atPath:))

Removes the file or directory at the specified path.

[`func trashItem(at: URL, resultingItemURL: AutoreleasingUnsafeMutablePointer<NSURL?>?) throws`](/documentation/Foundation/FileManager/trashItem(at:resultingItemURL:))

Moves an item to the trash.

### Replacing items

[`func replaceItemAt(URL, withItemAt: URL, backupItemName: String?, options: FileManager.ItemReplacementOptions) throws -> URL?`](/documentation/Foundation/FileManager/replaceItemAt(_:withItemAt:backupItemName:options:))

Replaces the contents of the item at the specified URL in a manner that ensures no data loss occurs.

[`func replaceItem(at: URL, withItemAt: URL, backupItemName: String?, options: FileManager.ItemReplacementOptions, resultingItemURL: AutoreleasingUnsafeMutablePointer<NSURL?>?) throws`](/documentation/Foundation/FileManager/replaceItem(at:withItemAt:backupItemName:options:resultingItemURL:))

Replaces the contents of the item at the specified URL in a manner that ensures no data loss occurs.

[`struct ItemReplacementOptions`](/documentation/Foundation/FileManager/ItemReplacementOptions)

Options for specifying the behavior of file replacement operations.

### Moving and copying items

[`func copyItem(at: URL, to: URL) throws`](/documentation/Foundation/FileManager/copyItem(at:to:))

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

[`func copyItem(atPath: String, toPath: String) throws`](/documentation/Foundation/FileManager/copyItem(atPath:toPath:))

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

[`func moveItem(at: URL, to: URL) throws`](/documentation/Foundation/FileManager/moveItem(at:to:))

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

[`func moveItem(atPath: String, toPath: String) throws`](/documentation/Foundation/FileManager/moveItem(atPath:toPath:))

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

### Managing iCloud-based items

[`var ubiquityIdentityToken: (any NSCoding & NSCopying & NSObjectProtocol)?`](/documentation/Foundation/FileManager/ubiquityIdentityToken)

An opaque token that represents the current user’s iCloud Drive Documents identity.

[`func url(forUbiquityContainerIdentifier: String?) -> URL?`](/documentation/Foundation/FileManager/url(forUbiquityContainerIdentifier:))

Returns the URL for the iCloud container associated with the specified identifier and establishes access to that container.

[`func isUbiquitousItem(at: URL) -> Bool`](/documentation/Foundation/FileManager/isUbiquitousItem(at:))

Returns a Boolean indicating whether the item is targeted for storage in iCloud.

[`func setUbiquitous(Bool, itemAt: URL, destinationURL: URL) throws`](/documentation/Foundation/FileManager/setUbiquitous(_:itemAt:destinationURL:))

Indicates whether the item at the specified URL should be stored in iCloud.

[`func startDownloadingUbiquitousItem(at: URL) throws`](/documentation/Foundation/FileManager/startDownloadingUbiquitousItem(at:))

Starts downloading (if necessary) the specified item to the local system.

[`func evictUbiquitousItem(at: URL) throws`](/documentation/Foundation/FileManager/evictUbiquitousItem(at:))

Removes the local copy of the specified item that’s stored in iCloud.

[`func url(forPublishingUbiquitousItemAt: URL, expiration: AutoreleasingUnsafeMutablePointer<NSDate?>?) throws -> URL`](/documentation/Foundation/FileManager/url(forPublishingUbiquitousItemAt:expiration:))

Returns a URL that can be emailed to users to allow them to download a copy of a flat file item from iCloud.

### Accessing file provider services

[`func getFileProviderServicesForItem(at: URL, completionHandler: ([NSFileProviderServiceName : NSFileProviderService]?, (any Error)?) -> Void)`](/documentation/Foundation/FileManager/getFileProviderServicesForItem(at:completionHandler:))

Returns the services provided by the File Provider extension that manages the item at the given URL.

[`class NSFileProviderService`](/documentation/Foundation/NSFileProviderService)

A service that provides a custom communication channel between your app and a File Provider extension.

[`struct NSFileProviderServiceName`](/documentation/Foundation/NSFileProviderServiceName)

The name used to identify a File Provider service.

### Controlling file provider synchronization

[`struct NSFileManagerSupportedSyncControls`](/documentation/Foundation/NSFileManagerSupportedSyncControls)

An option set of the sync controls available for an item.

[`func pauseSyncForUbiquitousItem(at: URL, completionHandler: ((any Error)?) -> Void)`](/documentation/Foundation/FileManager/pauseSyncForUbiquitousItem(at:completionHandler:))

Asynchronously pauses sync of an item at the given URL.

[`func resumeSyncForUbiquitousItem(at: URL, with: NSFileManagerResumeSyncBehavior, completionHandler: ((any Error)?) -> Void)`](/documentation/Foundation/FileManager/resumeSyncForUbiquitousItem(at:with:completionHandler:))

Asynchronously resumes the sync on a paused item using the given resume behavior.

[`enum NSFileManagerResumeSyncBehavior`](/documentation/Foundation/NSFileManagerResumeSyncBehavior)

The behaviors the file manager can apply to resolve conflicts when resuming a sync.

[`func fetchLatestRemoteVersionOfItem(at: URL, completionHandler: (NSFileVersion?, (any Error)?) -> Void)`](/documentation/Foundation/FileManager/fetchLatestRemoteVersionOfItem(at:completionHandler:))

Asynchronously fetches the latest remote version of a given item from the server.

[`class NSFileVersion`](/documentation/Foundation/NSFileVersion)

A snapshot of a file at a specific point in time.

[`func uploadLocalVersionOfUbiquitousItem(at: URL, withConflictResolutionPolicy: NSFileManagerUploadLocalVersionConflictPolicy, completionHandler: (NSFileVersion?, (any Error)?) -> Void)`](/documentation/Foundation/FileManager/uploadLocalVersionOfUbiquitousItem(at:withConflictResolutionPolicy:completionHandler:))

Asynchronously uploads the local version of the item using the provided conflict resolution policy.

[`enum NSFileManagerUploadLocalVersionConflictPolicy`](/documentation/Foundation/NSFileManagerUploadLocalVersionConflictPolicy)

The policies the file manager can apply to resolve conflicts when uploading a local version of a file.

### Creating symbolic and hard links

[`func createSymbolicLink(at: URL, withDestinationURL: URL) throws`](/documentation/Foundation/FileManager/createSymbolicLink(at:withDestinationURL:))

Creates a symbolic link at the specified URL that points to an item at the given URL.

[`func createSymbolicLink(atPath: String, withDestinationPath: String) throws`](/documentation/Foundation/FileManager/createSymbolicLink(atPath:withDestinationPath:))

Creates a symbolic link that points to the specified destination.

[`func linkItem(at: URL, to: URL) throws`](/documentation/Foundation/FileManager/linkItem(at:to:))

Creates a hard link between the items at the specified URLs.

[`func linkItem(atPath: String, toPath: String) throws`](/documentation/Foundation/FileManager/linkItem(atPath:toPath:))

Creates a hard link between the items at the specified paths.

[`func destinationOfSymbolicLink(atPath: String) throws -> String`](/documentation/Foundation/FileManager/destinationOfSymbolicLink(atPath:))

Returns the path of the item pointed to by a symbolic link.

### Determining access to files

[`func fileExists(atPath: String) -> Bool`](/documentation/Foundation/FileManager/fileExists(atPath:))

Returns a Boolean value that indicates whether a file or directory exists at a specified path.

[`func fileExists(atPath: String, isDirectory: UnsafeMutablePointer<ObjCBool>?) -> Bool`](/documentation/Foundation/FileManager/fileExists(atPath:isDirectory:))

Returns a Boolean value that indicates whether a file or directory exists at a specified path.

[`func isReadableFile(atPath: String) -> Bool`](/documentation/Foundation/FileManager/isReadableFile(atPath:))

Returns a Boolean value that indicates whether the invoking object appears able to read a specified file.

[`func isWritableFile(atPath: String) -> Bool`](/documentation/Foundation/FileManager/isWritableFile(atPath:))

Returns a Boolean value that indicates whether the invoking object appears able to write to a specified file.

[`func isExecutableFile(atPath: String) -> Bool`](/documentation/Foundation/FileManager/isExecutableFile(atPath:))

Returns a Boolean value that indicates whether the operating system appears able to execute a specified file.

[`func isDeletableFile(atPath: String) -> Bool`](/documentation/Foundation/FileManager/isDeletableFile(atPath:))

Returns a Boolean value that indicates whether the invoking object appears able to delete a specified file.

### Getting and setting attributes

[`func componentsToDisplay(forPath: String) -> [String]?`](/documentation/Foundation/FileManager/componentsToDisplay(forPath:))

Returns an array of strings representing the user-visible components of a given path.

[`func displayName(atPath: String) -> String`](/documentation/Foundation/FileManager/displayName(atPath:))

Returns the display name of the file or directory at a specified path.

[`func attributesOfItem(atPath: String) throws -> [FileAttributeKey : Any]`](/documentation/Foundation/FileManager/attributesOfItem(atPath:))

Returns the attributes of the item at a given path.

[`func attributesOfFileSystem(forPath: String) throws -> [FileAttributeKey : Any]`](/documentation/Foundation/FileManager/attributesOfFileSystem(forPath:))

Returns a dictionary that describes the attributes of the mounted file system on which a given path resides.

[`func setAttributes([FileAttributeKey : Any], ofItemAtPath: String) throws`](/documentation/Foundation/FileManager/setAttributes(_:ofItemAtPath:))

Sets the attributes of the specified file or directory.

### Getting and comparing file contents

[`func contents(atPath: String) -> Data?`](/documentation/Foundation/FileManager/contents(atPath:))

Returns the contents of the file at the specified path.

[`func contentsEqual(atPath: String, andPath: String) -> Bool`](/documentation/Foundation/FileManager/contentsEqual(atPath:andPath:))

Returns a Boolean value that indicates whether the files or directories in specified paths have the same contents.

### Getting the relationship between items

[`func getRelationship(UnsafeMutablePointer<FileManager.URLRelationship>, ofDirectoryAt: URL, toItemAt: URL) throws`](/documentation/Foundation/FileManager/getRelationship(_:ofDirectoryAt:toItemAt:))

Determines the type of relationship that exists between a directory and an item.

[`func getRelationship(UnsafeMutablePointer<FileManager.URLRelationship>, of: FileManager.SearchPathDirectory, in: FileManager.SearchPathDomainMask, toItemAt: URL) throws`](/documentation/Foundation/FileManager/getRelationship(_:of:in:toItemAt:))

Determines the type of relationship that exists between a system directory and the specified item.

[`enum URLRelationship`](/documentation/Foundation/FileManager/URLRelationship)

Constants indicating the relationship between a directory and an item.

### Converting file paths to strings

[`func fileSystemRepresentation(withPath: String) -> UnsafePointer<CChar>`](/documentation/Foundation/FileManager/fileSystemRepresentation(withPath:))

Returns a C-string representation of a given path that properly encodes Unicode strings for use by the file system.

[`func string(withFileSystemRepresentation: UnsafePointer<CChar>, length: Int) -> String`](/documentation/Foundation/FileManager/string(withFileSystemRepresentation:length:))

Returns an [`NSString`](/documentation/Foundation/NSString) object whose contents are derived from the specified C-string path.

### Managing the delegate

[`var delegate: (any FileManagerDelegate)?`](/documentation/Foundation/FileManager/delegate)

The delegate of the file manager object.

### Managing the current directory

[`func changeCurrentDirectoryPath(String) -> Bool`](/documentation/Foundation/FileManager/changeCurrentDirectoryPath(_:))

Changes the path of the current working directory to the specified path.

[`var currentDirectoryPath: String`](/documentation/Foundation/FileManager/currentDirectoryPath)

The path to the program’s current directory.

### Unmounting volumes

[`func unmountVolume(at: URL, options: FileManager.UnmountOptions, completionHandler: ((any Error)?) -> Void)`](/documentation/Foundation/FileManager/unmountVolume(at:options:completionHandler:))

Starts the process of unmounting the specified volume.

[`struct UnmountOptions`](/documentation/Foundation/FileManager/UnmountOptions)

Options that specify the behavior of an unmount operation.

[`let NSFileManagerUnmountDissentingProcessIdentifierErrorKey: String`](/documentation/Foundation/NSFileManagerUnmountDissentingProcessIdentifierErrorKey)

The process identifier of the process that prevented a volume from unmounting.

### Working with HFS file types

[`func NSFileTypeForHFSTypeCode(OSType) -> String!`](/documentation/Foundation/NSFileTypeForHFSTypeCode(_:))

Returns a string encoding a file type code.

[`func NSHFSTypeCodeFromFileType(String!) -> OSType`](/documentation/Foundation/NSHFSTypeCodeFromFileType(_:))

Returns a file type code.

[`func NSHFSTypeOfFile(String!) -> String!`](/documentation/Foundation/NSHFSTypeOfFile(_:))

Returns a string encoding a file type.

### Determining resource fork support

[`var NSFoundationVersionWithFileManagerResourceForkSupport: Int32`](/documentation/Foundation/NSFoundationVersionWithFileManagerResourceForkSupport)

The version of the Foundation framework in which `NSFileManager` first supported resource forks.

### Working with notifications

[`static let NSUbiquityIdentityDidChange: NSNotification.Name`](/documentation/Foundation/NSNotification/Name-swift.struct/NSUbiquityIdentityDidChange)

Sent after the iCloud (“ubiquity”) identity has changed.

### Working with notification messages

[`struct UbiquityIdentityDidChangeMessage`](/documentation/Foundation/FileManager/UbiquityIdentityDidChangeMessage)

A message a file manager sends after the iCloud (“ubiquity”) identity changes.

### Supporting Types

[`struct DirectoryEnumerationOptions`](/documentation/Foundation/FileManager/DirectoryEnumerationOptions)

Options for enumerating the contents of directories.

[`enum SearchPathDirectory`](/documentation/Foundation/FileManager/SearchPathDirectory)

The location of significant directories.

[`struct SearchPathDomainMask`](/documentation/Foundation/FileManager/SearchPathDomainMask)

Domain constants specifying base locations to use when you search for significant directories.

[`struct FileAttributeKey`](/documentation/Foundation/FileAttributeKey)

Keys in dictionaries used to get and set file attributes.

[`struct FileAttributeType`](/documentation/Foundation/FileAttributeType)

Values representing a file’s type attribute.

[`struct FileProtectionType`](/documentation/Foundation/FileProtectionType)

Protection level values that can be associated with a file attribute key.

[`struct URLFileProtection`](/documentation/Foundation/URLFileProtection)

Protection-level values for a URL resource key.

### Deprecated Methods

[`- (BOOL) copyPath:(NSString *) src toPath:(NSString *) dest handler:(id) handler;`](/documentation/Foundation/NSFileManager/copyPath:toPath:handler:)

Copies the directory or file specified in a given path to a different location in the file system identified by another path.

[`- (BOOL) movePath:(NSString *) src toPath:(NSString *) dest handler:(id) handler;`](/documentation/Foundation/NSFileManager/movePath:toPath:handler:)

Moves the directory or file specified by a given path to a different location in the file system identified by another path.

[`- (BOOL) removeFileAtPath:(NSString *) path handler:(id) handler;`](/documentation/Foundation/NSFileManager/removeFileAtPath:handler:)

Deletes the file, link, or directory (including, recursively, all subdirectories, files, and links in the directory) identified by a given path.

[`func changeFileAttributes([AnyHashable : Any], atPath: String) -> Bool`](/documentation/Foundation/FileManager/changeFileAttributes(_:atPath:))

Changes the attributes of a given file or directory.

[`func fileAttributes(atPath: String, traverseLink: Bool) -> [AnyHashable : Any]?`](/documentation/Foundation/FileManager/fileAttributes(atPath:traverseLink:))

Returns a dictionary that describes the POSIX attributes of the file specified at a given.

[`func fileSystemAttributes(atPath: String) -> [AnyHashable : Any]?`](/documentation/Foundation/FileManager/fileSystemAttributes(atPath:))

Returns a dictionary that describes the attributes of the mounted file system on which a given path resides.

[`func directoryContents(atPath: String) -> [Any]?`](/documentation/Foundation/FileManager/directoryContents(atPath:))

Returns the directories and files (including symbolic links) contained in a given directory.

[`func createDirectory(atPath: String, attributes: [AnyHashable : Any]) -> Bool`](/documentation/Foundation/FileManager/createDirectory(atPath:attributes:))

Creates a directory (without contents) at a given path with given attributes.

[`func createSymbolicLink(atPath: String, pathContent: String) -> Bool`](/documentation/Foundation/FileManager/createSymbolicLink(atPath:pathContent:))

Creates a symbolic link identified by a given path that refers to a given location.

[`func pathContentOfSymbolicLink(atPath: String) -> String?`](/documentation/Foundation/FileManager/pathContentOfSymbolicLink(atPath:))

Returns the path of the directory or file that a symbolic link at a given path refers to.

[`- (BOOL) linkPath:(NSString *) src toPath:(NSString *) dest handler:(id) handler;`](/documentation/Foundation/NSFileManager/linkPath:toPath:handler:)

Creates a link from a source to a destination.

  <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/fileManager(_:shouldProceedAfterError:)>

  <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/fileManager(_:willProcessPath:)>

[`func replaceItemAtURL(originalItemURL: NSURL, withItemAtURL: NSURL, backupItemName: String?, options: FileManager.ItemReplacementOptions) throws -> NSURL?`](/documentation/Foundation/FileManager/replaceItemAtURL(originalItemURL:withItemAtURL:backupItemName:options:))

Replaces the contents of the item at the specified URL in a manner that ensures no data loss occurs.

## Relationships

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

### Conforms To

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

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

[`Hashable`](/documentation/Swift/Hashable)

---

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)