performFileOperation(_:source:destination:files:tag:)
Performs a file operation on a set of files in a particular directory.
Declaration
func performFileOperation(_ operation: NSWorkspace.FileOperationName, source: String, destination: String, files: [Any], tag: UnsafeMutablePointer<Int>?) -> BoolParameters
- operation:
The file operation to perform. The possible values for this parameter are described in
File Operations. - source:
The full path to the directory containing the files on which to operate.
- destination:
The full path to the destination directory of the operation.
- files:
An array of Nsstring objects specifying the names of the files and directories to be manipulated. Each string must not contain any path information other than the name of the file or directory. In other words, all of the files and directories must be located in the source directory and not in one if its subdirectories.
- tag:
On input, a integer variable; on return, this variable contains a negative integer if the operation fails, 0 if the operation was performed synchronously and succeeded, or a positive integer if the operation was performed asynchronously. If the value is a positive integer, the value is a tag that identifies the requested file operation.
Return Value
Discussion
Some operations—such as moving, copying, and linking files—require a destination directory to be specified. If not, destination should be the empty string (@""). Before this method returns, it posts an didPerformFileOperationNotification to the NSWorkspace object’s notification center.
It is safe to call this method from any thread of your app.
See Also
Methods
open(_:options:configuration:)open(_:withApplicationAt:options:configuration:)openFile(_:)openFile(_:withApplication:)openFile(_:withApplication:andDeactivate:)openFile(_:from:at:in:)launchApplication(_:)launchApplication(_:showIcon:autolaunch:)launchApplication(at:options:configuration:)fullPath(forApplication:)absolutePathForApplication(withBundleIdentifier:)launchApplication(withBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:)open(_:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:)mountedRemovableMedia()mountedLocalVolumePaths()