title: How to get a list of folder and file Google Drive API IOS?
body: <p>I want to get all file and folder name from my google drive using google drive API.</p>
  
  <p>My query is like this:</p>
  
  <pre><code> GTLQueryDrive *query = [GTLQueryDrive queryForFilesList];
  
      query.q = @"";
       //or i also use this code
  
    query.q = @"mimeType = 'text/plain'";
  </code></pre>
  
  <p>Even I also tried this code:</p>
  
  <pre><code>-(void)getFileListFromSpecifiedParentFolder {
      GTLQueryDrive *query2 = [GTLQueryDrive queryForChildrenListWithFolderId:@"root"];
      query2.maxResults = 1000;
  
      // queryTicket can be used to track the status of the request.
      [self.driveService executeQuery:query2
                    completionHandler:^(GTLServiceTicket *ticket,
                                        GTLDriveChildList *children, NSError *error) {
                        NSLog(@"\nGoogle Drive: file count in the folder: %d", children.items.count);
                        //incase there is no files under this folder then we can avoid the fetching process
                        if (!children.items.count) {
                            return ;
                        }
  
                        if (error == nil) {
                            for (GTLDriveChildReference *child in children) {
  
                                GTLQuery *query = [GTLQueryDrive queryForFilesGetWithFileId:child.identifier];
  
                                // queryTicket can be used to track the status of the request.
                                [self.driveService executeQuery:query
                                              completionHandler:^(GTLServiceTicket *ticket,
                                                                  GTLDriveFile *file,
                                                                  NSError *error) {
  
                                                  NSLog(@"\nfile name = %@", file.originalFilename);
                                              }];
                            }
                        }
                    }];
  }
  </code></pre>