• iOS --创建文件夹 ,删除文件夹


    //创建文件夹 --》 返回 文件夹
    - (NSString *)pathToPatientPhotoFolder {
        NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
                                                                        NSUserDomainMask,
                                                                        YES) lastObject];
        NSString *patientPhotoFolder = [documentsDirectory stringByAppendingPathComponent:@"patientPhotoFolder"];
    
        // Create the folder if necessary
        BOOL isDir = NO;
        NSFileManager *fileManager = [[NSFileManager alloc] init];
        if (![fileManager fileExistsAtPath:patientPhotoFolder
                               isDirectory:&isDir] && isDir == NO) {
            [fileManager createDirectoryAtPath:patientPhotoFolder
                   withIntermediateDirectories:NO
                                    attributes:nil
                                         error:nil];
        }
        return patientPhotoFolder;
    }
    


    //删除文件
    - (void)remove
    {
    NSString *patientPhotoFolder = [[NSFileManager defaultManager] pathToPatientPhotoDirectory];
    NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:patientPhotoFolder error:nil];
    for (NSString *filename in contents) {
    [[NSFileManager defaultManager] removeItemAtPath:[patientPhotoFolder stringByAppendingPathComponent:filename] error:NULL];
    }
    }
  • 相关阅读:
    自动控制基础MATLAB 2
    钽电容和瓷片电容的对比
    自动控制原理基础 matlab 1
    Altium使用总结1
    Altium 各个层的作用
    C语言联合体的灵活运用
    windows清除日志
    Lingo 优化实例 出版社问题
    Lingo 0-1规划
    用CMD分类
  • 原文地址:https://www.cnblogs.com/shenlaiyaoshi/p/7954249.html
Copyright © 2020-2023  润新知