With the following code, I'm able to list all the folders in my Drive.
function listFiles() {
gapi.client.drive.files.list({
'maxResults': 1000,
'q': "mimeType contains 'application/vnd.google-apps.folder'"
}).then(function(response) {
appendPre('Arquivos:\n');
var files = response.result.items;
if (files && files.length > 0) {
for (var i = 0; i < files.length; i++) {
var file = files[i];
appendPre(file.title + ' - ' + file.embedLink);
console.log(file);
However, now that I can list the folders, I'd like to be able to list the files that are inside them. I am grateful to those who can help.