'Getting files from Sharepoint using .Net

Good afternoon, I am using the Microsoft.SharePointOnline.CSOM library to work with Sharepoint. I have a code where I get a list called MyDoc like this:

using (var context = new ClientContext(url)
{
      varweb = context.Web;
      var list = web.Lists.GetByTitle("MyDocs");
}

Then I iterate through all the folders to find a folder with a suitable name and get files from there. With the help of file.ServerRelativeUrl I found out the link to the file on Sharepoint:

/MyDocs/Documents/Students/Homework/1lesson.pdf

How can I immediately access the Homework folder and download all the files from there without going through all the possible folders in the MyDocs sheet?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source