如何获得在C#中的网络驱动器的大小(不"映射驱动器")

如何获得在C#中的网络驱动器的大小(不"映射驱动器")

问题描述:

我需要得到一个网络驱动器的自由空间,没有映射驱动器

I need to get the free space of a Network drive, without "map drive"

DriveInfo drvInfo = new DriveInfo("\\NetworkDrive");



我尝试这样做,但它不能正常工作。

I try to do this but it does not work.

我相信你会需要调用 GetDiskFreeSpace (Win32 API的)通过的P/Invoke ,以获得一个UNC网络驱动器的磁盘可用空间。

I believe you will need to call GetDiskFreeSpace (Win32 API) via P/Invoke to get the disk free space of a UNC network drive.

C#GetDiskFreeSpace UNC 一>