title: How to tell if a directory is a windows junction in python
body: <p>I am running <code>os.walk()</code> on <code>"C:\Users\confusedDev\Documents"</code>, I see <code>["My Music", "My Pictures"...]</code> returned as subDirs but they are not actually being visited. After some research I found that they are actually <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa365006(v=vs.85).aspx" rel="nofollow noreferrer">junctions</a> in Windows.</p>
  
  <p>My understanding is that junction is a symlink points to directory, which gets ignored by default during <code>os.walk()</code>, but the following test has failed me</p>
  
  <pre><code>&gt;&gt;&gt; os.path.islink("C:\\Users\\confusedDev\\Documents\\My Pictures")
  False
  </code></pre>
  
  <p>hmm...how did <code>os.walk()</code> know that "C:\Users\confusedDev\Documents\My Pictures" is a symlink to "C:\Users\confusedDev\Pictures" and needed to be skipped? I want to call the same api...For now, my workaround logic simply assumes that if a directory is skipped by <code>os.walk()</code>, it is a junction</p>