I'm using this code to get the subfolders of a directory:
Dim fo As Scripting.Folder
Set fo = fso.GetFolder(m_sFolder)
Dim nSubfolder As Scripting.Folder
For Each nSubfolder In fo.SubFolders
Debug.Print "Folder " & fo.Path & " has subfolder " & nSubfolder
Next
Now when m_sFolder is "C:\Users\MyUser\Documents", one subfolder is "C:\Users\MyUser\Documents\Eigene Bilder". "Eigene Bilder" is what Windows calls the folder "My Pictures" in German language.
However, the folder "C:\Users\MyUser\Documents" doesn't contain either "My Pictures", "Pictures" or "Eigene Bilder".
The folder "My Pictures" is to be found here: C:\Users\MyUser\Pictures
Can anybody tell me why FSO might want to tell me that this directory "C:\Users\MyUser\Documents\Eigene Bilder" exists?
I'm completely baffled.
If you insist on using the FSO you need to be aware of these things. This example makes an attempt to be aware, and should give you the information you need to deal with this:
It's not a Directory it's a Junction (or Reparse) Point which is like a redirection to another location at the filesystem level.
From the command line will list these with a
<JUNCTION>
tag (as opposed to<DIR>
).There is no need to use the FSO, the built in filesystem functions will not include these: