Walking Directories Finds A Directory That Doesn't Exist

Copper Contributor

I have a VBA application that walks directories and captures the number of files in each and their total size.  I hit an unusual problem.  A directory contains a reference to a subdirectory that doesn’t exist.

The reference is:
C:\Program Files (x86)\Microsoft Office\root\vfs\Common AppData\Application Data\*.*
It comes from:
FindFirstFileW(sPathFileUTF32, fdW)
Where sPathFileUTF32 is:
C:\Program Files (x86)\Microsoft Office\root\vfs\Common AppData

Attempt to walk it:
FindFirstFileW(sPathFileUTF32, fdW)
Where sPathFileUTF32 is:
C:\Program Files (x86)\Microsoft Office\root\vfs\Common AppData\Application Data\*.*
Throws an error:
Error[3]: The system cannot find the path specified.

File Manager does not see that subdirectory:

saberman_0-1704146545062.png

 

Dir in a CMD window does not see that subdirectory:

saberman_1-1704146545087.png

 

Why does FindFirstFileW return a path to a directory that does not exist?

2 Replies
Because the modern file system is WAY more complicated than your grandfather's file system. It contains virtual elements, and some APIs may see more than others.
I am using the same API to look at the parent directory as to look at the non-existent subdirectory.

The question is why would there be an entry in a directory for a subdirectory that doesn't exist.?