Я могу копировать файлы из моего основного комплекта в каталог «Документы» по имени файла с кодом ниже, но как я могу копировать на основе подстановочного знака? Например, у меня есть несколько файлов с именем myimageX.jpg (x обозначает случайное число). Я хотел бы просмотреть все из них, которые содержатся в моем основном комплекте, и, если их нет в Документах, скопируйте их.
BOOL success;
NSFileManager *fileManager = [NSFileManager defaultManager];
myfileName = @"myimage322.jpg";
documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
documentsDir = [documentPaths objectAtIndex:0];
filePath = [documentsDir stringByAppendingPathComponent:myfileName];
success = [fileManager fileExistsAtPath:filePath];
if(success) return;
NSString *filePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:myfileName];
[fileManager copyItemAtPath:filePathFromApp toPath:filePath error:nil];
[fileManager release];