내 문서 폴더에있는 폴더에 파일이 있습니다. 다른 이름으로 다른 폴더에 파일의 사본을 만들고 싶습니다. 코드 나는 사용하고있다파일 관리자를 사용하여 파일 관리자를 사용하여 파일 사본을 만드는 것이 Mac 응용 프로그램에서 작동하지 않습니다
NSFileManager *fileManager = [[NSFileManager alloc] init];
NSString * filePath = [NSHomeDirectory() stringByAppendingPathComponent:
[NSString stringWithFormat:@"Documents/test/test1/%@%@%@",str,currentaudioTobPlayed,@".mp3"]];
NSString * filePath2 = [NSHomeDirectory() stringByAppendingPathComponent:
[NSString stringWithFormat:@"Documents/test/test1/"]];
NSLog(@"filePat %@",filePath);
NSLog(@"filePath2 %@",filePath2);
NSLog(@"filePath2 %@",fileManager);
[fileManager copyItemAtPath:filePath toPath:filePath2 error:NULL];
[fileManager release];
그러나이 코드는 작동하지 않습니다. 제발 도와주세요!
@Bavarious 고맙습니다! 그것이 효과가있었습니다. 만약 당신이 대답했다면, 나는 당신에게 투표했을 것입니다. 어쨌든 고맙습니다. – Swastik
저는 의견을 본격적인 대답으로 옮겼습니다. –