NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *documentPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"]; NSString* tempstr = [documentPath stringByAppendingPathComponent:@"menu.plist"]; if (![fileManager fileExistsAtPath:tempstr]) {//如果指定目录不存在该文件 NSString *defaultpath = [[NSBundle mainBundle]pathForResource:@"menu" ofType:@"plist"]; if (defaultpath)
{ [fileManager copyItemAtPath:defaultpath toPath:tempstr error:NULL];//拷贝文件 从一个路径拷贝到另一个路径 } }