Previous | Index | Next |
URL and File related methods
moveItemAt:toItem:replace:error:
Moves item, with atomic replacement if replaceFlag is true and destination item already exists. Pass aliases, files, HFS paths, POSIX paths or NSURLs.
+ (BOOL)moveItemAt:(id)urlFileOrPath toItem:(id)destUrlFileOrPath replace:(BOOL)replaceFlag error:(NSError *__autoreleasing *)outError
urlFileOrPath = source alias, file, HFS path, POSIX path or NSURL
destUrlFileOrPath = destination alias, file, HFS path, POSIX path or NSURL
replaceFlag = whether to replace existing file
outError = missing value or reference
True if it succeeds, false if not. See Notes.
Version 1.3.0
If you set outError to reference, the result will be a list of two items. If there is no error, the first item will be the result of the method and the second will be missing value. If there is an error, the first item will be missing value and the second item with be an NSError.
use scripting additions
use framework "Foundation"
use script "BridgePlus"
load framework
set {theResult, theError} to (current application's SMSForder's moveItemAt:"~/Documents/Something" toItem:"~/Desktop/Something Else" replace:true |error|:(reference))
if theResult as boolean is false then error (theError's localizedDescription() as text)