【问题标题】:How to delete files which contain words in the iOS documentsDirectory [closed]如何删除iOS文档目录中包含单词的文件[关闭]
【发布时间】:2012-10-21 20:15:33
【问题描述】:

我想删除文档目录中的几个图像文件。文档目录下已经有大量文件,我只想删除文件名中包含“Test”字样的文件。

我该怎么做?

【问题讨论】:

标签: iphone objective-c ios xcode nsdocumentdirectory


【解决方案1】:

很简单。查看[NSFileManager contentsOfDirectoryAtPath:error:],它列出了指定目录中的所有文件。然后您可以根据需要过滤/迭代数组。

要删除文件,请使用[NSFileManager removeItemAtPath:error:]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-02
    • 2011-03-21
    • 1970-01-01
    • 2021-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多