We help IT Professionals succeed at work.

GetDiskFreeSpaceEx with UNC

Ocrana used Ask the Experts™

I have a problem to receive the free disk space with an UNC path.
Like "\\HPOne\Video\Temp\" reports allways -1 if I try to call it with GetDiskFreeSpaceEx.
A nornal "C:\Test\" works fine. Any Idea? MSDN states that it will work with UNC.

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
First, make sure it works from the command line: DIR \\HPOne\Video\Temp\

Next, check GetLastError(). (In the debugger, you can view the result of GetLastError() using the special constant @ERR) My guess is that you are getting ERROR_ACCESS_DENIED or ERROR_PATH_NOT_FOUND.

If you are getting ERROR_PATH_NOT_FOUND, try removing the trailing backslash.


Ok, last Error is PATH_NOT_FOUND. But this makes no sense cause "\\HPOne\Video\Temp\" is exact what the FileOpen Dialog will return. ALso removing the backlash do not work.
So what is wrong that the system report a pat string but next time said it is invalid (not found)?