且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何删除文件夹中的所有文件,但不是文件夹本身?

更新时间:2022-04-16 02:24:18

您应该致电 contentsOfDirectoryAtPath ,然后在它返回的所有路径上使用removeItemAtPath。

You should call contentsOfDirectoryAtPath on the directory in question, and then use removeItemAtPath on all of the paths it returns.