title: How to get the entire folder structure of Google drive quickly and efficiently？
body: <p>Now, I need to upload the files in the entire Google drive to s3, and need to maintain the same directory structure as Google drive. When I get the file structure of Google drive, I found that I can only get files from the root directory layer by layer, so that I can get the files and file paths completely.</p>
  
  <pre><code>def get_folderid_path(self, parent):
      children = self.get_request(q="'%s' in parents" % parent)
      for child in children:
          child_id = child.get("id")
          child_name = child.get("name")
          child_mime_type = child.get("mimeType")
          if child_mime_type == "application/vnd.google-apps.folder":
              self.folder_path = self.test_list[-1] + "/" + child_name
              self.test_list.append(self.folder_path)
              self.folder_id_path_dict[child_id] = self.folder_path
              self.get_folderid_path(child_id)
          elif child_mime_type == "application/octet-stream" and child_name.endswith(
              ".side"
          ):
              child_file_list = self.folder_id_childlist_dict.get(parent, [])
              if not child_file_list:
                  self.folder_id_childlist_dict[parent] = child_file_list
              child_file_list.append({"id": child_id, "name": child_name})
  
      if self.test_list:
          self.test_list.pop()
  </code></pre>
  
  <p>I use a recursive method, I do not know if there is a more convenient method.</p>