title: How to determine if a folder is nested in a SharePoint list
body: <p>Using the following code:</p>
  
  <pre><code>using (SPSite site = new SPSite("http://localhost/"))
  {
      using (SPWeb web = site.OpenWeb())
      {
          foreach (SPList list in web.Lists)
          {
              if (list.OnQuickLaunch)
              {
                  Console.WriteLine(list.Title);
  
                  foreach (SPListItem item in list.Folders)
                  {
                      Console.WriteLine("- " + item.Title);
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>and the output:</p>
  
  <pre><code>... various lists ...
  Shared Documents
  - Minutes
  - Second Level
  </code></pre>
  
  <p>I get all the folders back as a flat list - no real indication of the nesting that can happen as a folder is created as a child of another folder. Spelunking around with Visual Studio I can see a few interesting properties that might give me some clues (like item.Url and counting / characters or item.Folder.ParentFolder compared against something?), but there has got to be a simpler way.</p>
  
  <p>Thanks!</p>