从 Firebase 存储中删除包含内容的文件夹
我可以轻松删除子引用中的文件,但如何从 Firebase 存储中删除整个文件夹?
I can easily delete a file within a child reference, but how would I delete the entire folder from Firebase Storage?
let postRef = FIRStorage.storage().reference().child("posts/folderName")
postRef.deleteWithCompletion { (error) in
print(error)
}
错误文件不存在.有什么想法吗?
Error file does not exists. Any ideas?
长话短说,我们还没有实现递归(或文件夹)删除.此主题在另一篇文章中介绍:FirebaseStorage:如何删除目录
Long story short, we haven't implemented a recursive (or folder) delete. This topic is covered in another post: FirebaseStorage: How to Delete Directory
目前,我们建议将文件列表存储在其他来源(如实时数据库)中或使用 列出 API,然后根据需要删除文件.
For now, we recommend either storing a list of files in another source (like the Realtime Database) or using the list API, and then deleting files as necessary.
您也可以在 Firebase 控制台 (console.firebase.google.com) 中执行此类删除.
You can also perform this type of delete in the Firebase Console (console.firebase.google.com).
将来,我们可能会提供此类功能,但不会对其进行完全规范.
In the future, we may offer this sort of functionality, but don't have it fully spec'ed out.