File exists but not visible from other programs [duplicate]

Solution 1:

It might not really be there, Windows just simulates you that it is there (and only Windows knows that, so other programs don't find it).

Look for it under C:\Users\YourUserName\AppData\Local\VirtualStore\....

That might solve your issue; if you want to understand why it is there, google File and Registry Virtualization.

In a nutshell, for access control reasons, Windows doesn't allow just every program to write in that area, so if an older program needs to writes there, it redirects the file to your virtual storage, but simulates continuously that is where you thought it is.

Solution 2:

I recently came across this very same issue and found the reason why.

I ran my executable which is compiled against x86 on a 64 bit operating system and indeed the file was nowhere to be found from within my executable, not by open a file dialog, not by looking for the file in the directory with Directory.GetFiles() and not with File.Exists(). However when compiling my executable against x64 the file was found again with all of the previous methods.