我正在制作一个 Mac 应用程序,我正在尝试复制文件夹的内容和子目录并将其粘贴到另一个文件夹中。
我已经尝试了一切,但只有文件被复制。有没有办法做到这一点?
我正在使用copyItemAtPath:
API,下面是一些代码:
NSString *partsFromString = KSPPartsFromPathString;
NSString *partsToString = KSPPartsToPathString;
NSError *error = nil;
manager = [NSFileManager defaultManager];
BOOL result = [manager copyItemAtPath:partsFromString toPath:partsToString error:&error];
if (!result && error) {
NSLog(@"There was an error copying the file to the directory! %@", [error localizedDescription]);
}