| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

ナビゲーションに移動 検索に移動
552 バイト追加 、 2021年11月20日 (土) 07:39
==Tips==
===再起的にファイルパスを表示===
<pre>
static func printFiles(directoryPath: String) {
print(directoryPath);
do {
let fm = FileManager.default;
let fileNames = try fm.contentsOfDirectory(atPath: directoryPath);
for fileName in fileNames {
let childPath = directoryPath + "/" + fileName;
var isDir = ObjCBool(false);
fm.fileExists(atPath: childPath, isDirectory: &isDir);
if isDir.boolValue {
printFiles(directoryPath: childPath);
}
print("\t" + childPath);
}
} catch {
print(error);
}
}
</pre>
===UnitTest([[XCode]])===
----

案内メニュー