Get free disk space

前端 未结 13 1584
孤街浪徒
孤街浪徒 2020-12-02 13:04

Given each of the inputs below, I\'d like to get free space on that location. Something like

long GetFreeSpace(string path)

Inputs:

13条回答
  •  不思量自难忘°
    2020-12-02 13:35

    DriveInfo will help you with some of those (but it doesn't work with UNC paths), but really I think you will need to use GetDiskFreeSpaceEx. You can probably achieve some functionality with WMI. GetDiskFreeSpaceEx looks like your best bet.

    Chances are you will probably have to clean up your paths to get it to work properly.

提交回复
热议问题