이 코드는
-(void) copyDirectory:(NSString *)directory {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *documentDBFolderPath = [documentsDirectory stringByAppendingPathComponent:directory];
NSString *resourceDBFolderPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:directory];
if (![fileManager fileExistsAtPath:documentDBFolderPath]) {
//Create Directory!
[fileManager createDirectoryAtPath:documentDBFolderPath withIntermediateDirectories:NO attributes:nil error:&error];
NSArray *fileList = [fileManager contentsOfDirectoryAtPath:resourceDBFolderPath error:&error];
for (NSString *s in fileList) {
NSString *newFilePath = [documentDBFolderPath stringByAppendingPathComponent:s];
NSString *oldFilePath = [resourceDBFolderPath stringByAppendingPathComponent:s];
if (![fileManager fileExistsAtPath:newFilePath]) {
//File does not exist, copy it
[fileManager copyItemAtPath:oldFilePath toPath:newFilePath error:&error];
} else {
[fileManager removeItemAtPath:newFilePath error:&error];
[fileManager copyItemAtPath:oldFilePath toPath:newFilePath error:&error];
}
}
[self info:@"Copy finish!"];
}
}
디렉토리에 복사 할 폴더의 이름을 추가 작동
편집 :
폴더 참조로 추가해야합니다.엑스 코드에서 프로젝트로 폴더를 드래그

dcoument 디렉토리에 imagefolder 디렉토리를 복사 할 수 있습니다. 이 링크를 사용할 수 있습니다 http://stackoverflow.com/questions/17669944/copy-folder-from-main-bundle-to-main-bundle-to-documents-directory-in-iphone –