zoukankan      html  css  js  c++  java
  • iOS中判断一个文件夹是否存在

    #define DOCUMENTS_FOLDER_AUDIO @"" //你定义的audio对应的文件目录
    #define DOCUMENTS_FOLDER_VEDIO @"" //你定义的vedio对应的文件目录
     
     - (void)createFileDirectories
     {
         
         // 判断存放音频、视频的文件夹是否存在,不存在则创建对应文件夹
         
         NSFileManager *fileManager = [NSFileManager defaultManager];
         
         BOOL isDir = FALSE;
         
         BOOL isDirExist = [fileManager fileExistsAtPath:DOCUMENTS_FOLDER_AUDIO
                                             isDirectory:&isDir];
         
         
         
         if(!(isDirExist && isDir))
             
         {
             
             BOOL bCreateDir = [fileManager createDirectoryAtPath:DOCUMENTS_FOLDER_AUDIO
                                      withIntermediateDirectories:YES
                                                       attributes:nil
                                                            error:nil];
             
             if(!bCreateDir){
                 
                 NSLog(@"Create Audio Directory Failed.");
                 
             }
             
             NSLog(@"%@",DOCUMENTS_FOLDER_AUDIO);
             
         }
         
         
         
         isDir = FALSE;
         
         isDirExist = [fileManager fileExistsAtPath:DOCUMENTS_FOLDER_VEDIO
                                        isDirectory:&isDir];
         
         
         
         if(!(isDirExist && isDir)){
             
             BOOL bCreateDir = [fileManager createDirectoryAtPath:DOCUMENTS_FOLDER_VEDIO
                                      withIntermediateDirectories:YES
                                                       attributes:nil
                                                            error:nil];
             
             if(!bCreateDir){
                 
                 NSLog(@"Create Audio Directory Failed.");
                 
             }
             
             NSLog(@"%@",DOCUMENTS_FOLDER_VEDIO);
             
         }
         
     }
  • 相关阅读:
    Oracle Sql优化之报表和数据仓库运算
    Oracle Sql优化之Rownum的使用
    Oracle Sql优化之范围处理
    c++11编译指令
    python 爬小说
    exvim快捷键
    几个崩溃问题
    网络穿透
    c# 拉取网页
    tars安装记
  • 原文地址:https://www.cnblogs.com/SkyPrayer/p/2634411.html
Copyright © 2011-2022 走看看