1.获取沙盒路径

// 获取沙盒路径

NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];

2.创建文件夹

方式一:

// 想在documents目录下创建一个test文件夹

NSString *path = [documentsDirectory stringByAppendingPathComponent:@"test"];


方式二:

// 文件夹创建

NSFileManager *fileManage = [NSFileManager defaultManager];

//先判断这个文件夹是否存在,如果不存在则创建,否则不创建

if (![fileManage fileExistsAtPath:path]) {

    [fileManage createDirectoryAtPath:path attributes:nil];

};


3.删除文件夹

// 文件夹删除

[fileManage removeItemAtPath:path error:nil];

 

相关文章:

  • 2022-12-23
  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
  • 2022-02-15
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-02
  • 2022-02-26
  • 2022-01-17
相关资源
相似解决方案