Javascript 获取选定文件夹上的第一个子文件夹

Javascript 获取选定文件夹上的第一个子文件夹,javascript,google-api,google-drive-api,Javascript,Google Api,Google Drive Api,我只想返回Google Drive SDK中特定文件夹的子文件夹。如果我有以下结构 mainfolder -> //id:1234567 testing1 -> actuafile.png testing.png testing2 -> banass.png testing3 -> 我的测试代码到目前为止,但它打印了所有文件,包括testing1、testing2..和actualfi

我只想返回Google Drive SDK中特定文件夹的子文件夹。如果我有以下结构

 mainfolder -> //id:1234567
     testing1 ->
         actuafile.png
         testing.png
     testing2 ->
         banass.png
     testing3 ->
我的测试代码到目前为止,但它打印了所有文件,包括
testing1、testing2..
actualfile.png、testing.png…

var request = gapi.client.drive.files.list({
  'q': "'1234567' in parents"
});

request.execute(function(r){
    console.log(r);
});

我如何才能仅限于第一个文件夹?

进行搜索查询:


mimeType='application/vnd.google apps.folder'和父母中的'123456'进行搜索查询:


mimeType='application/vnd.google apps.folder'和'123456'在家长中

+1 Jay的答案。然而

包含
actualfile.png、testing.png
这一事实意味着它们还有123456作为父级。你的结构不是你描述的那样,而是

  mainfolder -> //id:1234567
     L_ testing1 
     L_ actuafile.png
     L_ testing.png
     L_ testing2 
     L_ banass.png
     L_ testing3
只需再次检查文件的父级是否与您认为的相同。很可能actualfile.png同时拥有主文件夹和测试1作为父文件夹,即

  mainfolder -> //id:1234567
     L_ testing1 
     L___L_ actuafile.png
     L___L_ testing.png
     L_ testing2 
     L___L_ banass.png
     L_ testing3

我在我的一个应用程序中这样做,所以这没有错。一定要确定。

+1杰伊的答案。然而

包含
actualfile.png、testing.png
这一事实意味着它们还有123456作为父级。你的结构不是你描述的那样,而是

  mainfolder -> //id:1234567
     L_ testing1 
     L_ actuafile.png
     L_ testing.png
     L_ testing2 
     L_ banass.png
     L_ testing3
只需再次检查文件的父级是否与您认为的相同。很可能actualfile.png同时拥有主文件夹和测试1作为父文件夹,即

  mainfolder -> //id:1234567
     L_ testing1 
     L___L_ actuafile.png
     L___L_ testing.png
     L_ testing2 
     L___L_ banass.png
     L_ testing3
我在我的一个应用程序中这样做,所以这没有错。只是确定一下