Open Classswift 6.0.1FoundationEssentials
FileManager
class FileManager
class FileManager
import FoundationEssentials
protocol Sendable
init()
class var `default`: FileManager { get }
var currentDirectoryPath: String { get }
weak var delegate: (any FileManagerDelegate)? { get set }
var homeDirectoryForCurrentUser: URL { get }
var temporaryDirectory: URL { get }
func attributesOfFileSystem(forPath path: String) throws -> [FileAttributeKey : Any]
func attributesOfItem(atPath path: String) throws -> [FileAttributeKey : Any]
func changeCurrentDirectoryPath(_ path: String) -> Bool
func contents(atPath path: String) -> Data?
func contentsEqual(atPath path1: String, andPath path2: String) -> Bool
func contentsOfDirectory(atPath path: String) throws -> [String]
func copyItem(at srcURL: URL, to dstURL: URL) throws
func copyItem(atPath srcPath: String, toPath dstPath: String) throws
func createDirectory(at url: URL, withIntermediateDirectories createIntermediates: Bool, attributes: [FileAttributeKey : Any]? = nil) throws
func createDirectory(atPath path: String, withIntermediateDirectories createIntermediates: Bool, attributes: [FileAttributeKey : Any]? = nil) throws
func createFile(atPath path: String, contents data: Data?, attributes attr: [FileAttributeKey : Any]? = nil) -> Bool
func createSymbolicLink(at url: URL, withDestinationURL destURL: URL) throws
func createSymbolicLink(atPath path: String, withDestinationPath destPath: String) throws
func destinationOfSymbolicLink(atPath path: String) throws -> String
func fileExists(atPath path: String) -> Bool
func fileExists(atPath path: String, isDirectory: inout Bool) -> Bool
func homeDirectory(forUser userName: String) -> URL?
func isDeletableFile(atPath path: String) -> Bool
func isExecutableFile(atPath path: String) -> Bool
func isReadableFile(atPath path: String) -> Bool
func isWritableFile(atPath path: String) -> Bool
func linkItem(at srcURL: URL, to dstURL: URL) throws
func linkItem(atPath srcPath: String, toPath dstPath: String) throws
func moveItem(at srcURL: URL, to dstURL: URL) throws
func moveItem(atPath srcPath: String, toPath dstPath: String) throws
func removeItem(at URL: URL) throws
func removeItem(atPath path: String) throws
func setAttributes(_ attributes: [FileAttributeKey : Any], ofItemAtPath path: String) throws
func string(withFileSystemRepresentation str: UnsafePointer<CChar>, length len: Int) -> String
func subpathsOfDirectory(atPath path: String) throws -> [String]
func url(for directory: FileManager.SearchPathDirectory, in domain: FileManager.SearchPathDomainMask, appropriateFor url: URL?, create shouldCreate: Bool) throws -> URL
func urls(for directory: FileManager.SearchPathDirectory, in domainMask: FileManager.SearchPathDomainMask) -> [URL]
func withFileSystemRepresentation<R>(for path: String, _ body: (UnsafePointer<CChar>?) throws -> R) rethrows -> R
struct DirectoryEnumerationOptions
struct ItemReplacementOptions
enum SearchPathDirectory
struct SearchPathDomainMask
enum URLRelationship
struct UnmountOptions
import Foundation
func componentsToDisplay(forPath path: String) -> [String]?
func contentsOfDirectory(at url: URL, includingPropertiesForKeys keys: [URLResourceKey]?, options mask: FileManager.DirectoryEnumerationOptions = []) throws -> [URL]
func displayName(atPath path: String) -> String
func enumerator(at url: URL, includingPropertiesForKeys keys: [URLResourceKey]?, options mask: FileManager.DirectoryEnumerationOptions = [], errorHandler handler: ((URL, any Error) -> Bool)? = nil) -> FileManager.DirectoryEnumerator?
func enumerator(atPath path: String) -> FileManager.DirectoryEnumerator?
func fileExists(atPath path: String, isDirectory: UnsafeMutablePointer<ObjCBool>?) -> Bool
func fileSystemRepresentation(withPath path: String) -> UnsafePointer<Int8>
func getRelationship(_ outRelationship: UnsafeMutablePointer<FileManager.URLRelationship>, of directory: FileManager.SearchPathDirectory, in domainMask: FileManager.SearchPathDomainMask, toItemAt url: URL) throws
func getRelationship(_ outRelationship: UnsafeMutablePointer<FileManager.URLRelationship>, ofDirectoryAt directoryURL: URL, toItemAt otherURL: URL) throws
func mountedVolumeURLs(includingResourceValuesForKeys propertyKeys: [URLResourceKey]?, options: FileManager.VolumeEnumerationOptions = []) -> [URL]?
Returns an array of URLs that identify the mounted volumes available on the device.
func replaceItem(at originalItemURL: URL, withItemAt newItemURL: URL, backupItemName: String?, options: FileManager.ItemReplacementOptions = []) throws -> URL?
func replaceItemAt(_ originalItemURL: URL, withItemAt newItemURL: URL, backupItemName: String? = nil, options: FileManager.ItemReplacementOptions = []) throws -> URL?
func subpaths(atPath path: String) -> [String]?
func url(for directory: FileManager.SearchPathDirectory, in domain: FileManager.SearchPathDomainMask, appropriateFor reference: URL?, create shouldCreate: Bool) throws -> URL
class DirectoryEnumerator
struct VolumeEnumerationOptions