title: Google Drive API v3 find files within specific folder
body: <p>I'm searching around trying to find a way to accomplish this simple task.. I'm probably missing something.</p>
  
  <p>I am downloading files off of the drive via a desktop application and saving them to the localhost. I have two problems:</p>
  
  <p>First, I use y drive for several things so I only want to download the files contained within a specific folder. I need a way to determin if a file is in the folder so I can decide whether or not to download it.</p>
  
  <p>this is what I have so far...</p>
  
  <pre><code>var service = new DriveService(new BaseClientService.Initializer()
  {
    HttpClientInitializer = credential,
    ApplicationName = ApplicationName, 
  });
  
  // Define parameters of request.
  FilesResource.ListRequest listRequest = service.Files.List();
  listRequest.PageSize = 100;
  listRequest.Fields = "nextPageToken, files(id, name)";
  
  
  // List files.
  IList&lt;Google.Apis.Drive.v3.Data.File&gt; files = listRequest.Execute().Files;
  Console.WriteLine("Files:");
  if (files != null &amp;&amp; files.Count &gt; 0)
   {
    foreach (var file in files)
     {
      Console.WriteLine("{0} ({1})", file.Name, file.Id);
  
      if (file.Name == "APIDSWelcome.txt")
       {
        id = file.Id;
  
        if  (file.MimeType == "application/vnd.google-apps.folder")
          {
  
          }
       }
     }
  
     foreach (var file in files)
      {
       if (file.Parents.Contains(id))
        {
          //download
  </code></pre>
  
  <p>Second, I have found a way to download the files but I am not sure were they are once the download is complete. How do I tell the application to save the files to a specific location on the local host? This is the code I am using for downloading...</p>
  
  <pre><code>var fileId = file.Id;
  var request = service.Files.Get(fileId);
  var stream = new System.IO.MemoryStream();
  
  // Add a handler which will be notified on progress changes.
  // It will notify on each chunk download and when the
  // download is completed or failed.
  request.MediaDownloader.ProgressChanged += (Google.Apis.Download.IDownloadProgress progress) =&gt;
    {
      switch (progress.Status)
       {
         case DownloadStatus.Downloading:
          {
           Console.WriteLine(progress.BytesDownloaded);
           break;
          }
          case DownloadStatus.Completed:
           {
             Console.WriteLine("Download complete.");
             break;
           }
          case DownloadStatus.Failed:
           {
             Console.WriteLine("Download failed.");
             break;
           }
         }
       };
         request.Download(stream);
          }
         }
        }
        else
         {
          Console.WriteLine("No files found.");
         }
  </code></pre>
  
  <p>Thank you for the help!</p>