問題描述
任何想法如何在單個查詢中查詢所有孩子和孩子的孩子?
Any ideas how to query for all the children and the children of the children in a single query?
更新
這似乎是一個簡單的問題.我懷疑是否有一個簡單的解決方案?
It seems like a simple question. I doubt if there is a simple solution?
查詢文件夾和文件樹可能會花費大量 API 調用.因此,為了解決我的問題,我使用單個查詢來列出所有者的所有文件和文件夾.此查詢還返回子文件和子文件夾.要在列表中找到文件夾及其所有子文件夾(文件夾、文件、子文件夾和子文件),我必須創建一個類似索引的樹.
Quering the tree of folders and files can cost a lot of API calls. So, to solve my problem, I use a single query to list all the files and folders of an owner. This query also returns subfiles and subfolders. To find the folder and all of its children (folder, files, subfolders and subfiles) in the list, I had to create a tree like index.
結論
單個查詢是不夠的.您必須列出所有或縮小與所有者的查詢.接下來您必須索引結果以(遞歸)找到文件夾的樹.
A single query is not enough. You have to list all or narrow the query with an owner. Next You have to index the results to (recursive) find the tree for the folder.
像 (ls -R in Unix) 這樣的查詢選項會很好.
A query option like (ls -R in Unix) would be nice.
推薦答案
我認為您在更新"中的想法是正確的.將 Drive 視為平面,調用列出所有內容,并從中生成您自己的樹.
I think you have the right idea in your "update". Treat Drive as flat, make calls to list everything, and generate your own tree from that.
這篇關于如何列出 Google Drive 文件夾的所有文件、文件夾、子文件夾和子文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!