![](/img/trans.png)
[英]swift how to get all files from a sub folder we created in document directory?
[英]How to get all the files from Applications document directory in swift?
我是 swift 語言的新手,我使用此代碼獲取文檔目錄
let paths = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true);
這是對的,但是當我們運行項目時,第二個腳本代碼每次都會改變,我的問題是我想將所有錄制的視頻存儲到文檔目錄,然后將所有錄制的視頻加載到我的應用程序的自定義庫中以查看應用程序的整體錄制的視頻,但是當我存儲這些視頻時,它會在每次新運行時存儲在不同的目錄中。
那么我如何才能從應用程序文檔目錄中獲取和加載整個錄制的視頻
do{
let files = try FileManager.default.contentsOfDirectory(atPath: documentsDirectory)
for filename in files {
print(filename)
}
}
catch {
print(error.localizedDescription)
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.