title: How to use Google Drive API to get list of all files in specific folder
body: <p>I'm working on a quicker way to get data from Google Drive for data entry purposes. I have a bunch of folders with images in them, and I need to get the URL of each image, plus the width and height in pixels (part of the properties of each image).</p>
  
  <p>I've never used the Google Drive API before, so I looked up the documentation. It has a demo app in JS that lists all files in the base directory of the drive. However, I don't know enough to change that to request the files in a certain folder.</p>
  
  <p>The idea is that the user pastes in the ID of a Google Drive folder, and then the JavaScript program returns the link, width and height. The user can then simply paste that into the data entry form.</p>
  
  <p>This is the function to list the files:</p>
  
  <pre><code>function listFiles() {
          gapi.client.drive.files.list({
            'pageSize': 10,
            'fields': "nextPageToken, files(id, name)",
          }).then(function(response) {
            appendPre('Files:');
            var files = response.result.files;
            if (files &amp;&amp; files.length &gt; 0) {
              for (var i = 0; i &lt; files.length; i++) {
                var file = files[i];
                appendPre(file.name + ' (' + file.id + ')');
              }
            } else {
              appendPre('No files found.');
            }
          });
        }
  </code></pre>
  
  <p>I've seen how to do it using a URL GET request, but have no idea how to translate that into a <code>gapi.client.drive</code> request as shown above.</p>
  
  <p>Any help here would be good.</p>