如何在UNC路径上找到可用空间\\serverName \ .....等。在c#中 [英] How to find available space on a UNC path \\serverName\.....etc. in c#

查看:114
本文介绍了如何在UNC路径上找到可用空间\\serverName \ .....等。在c#中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个应用程序,可以去UNC确定空间,我不知道如何做到这一点,我不认为DriveInfo类会这样做,因为它需要一个真正的驱动器名称。请记住,将UNC映射到本地服务器到网络驱动器不是一种选择。提前致谢。请随意提供详细信息,因为我是c#的新手,尤其是这个主题。

I am writing an application that would go to a UNC to determine the space avaialble, I don't how how to do this, I don't think DriveInfo class would do it because it expects a real drive name. Keeping in mind that mapping that UNC to the local server to a network drive is not an option here. Thanks in advance. Please feel free to be details as I am new in c# and in this subject in particular.

推荐答案

就我个人而言,我没有直接这样做,但是这个Stack Overflow问题有两种可能的解决方案:



http://stackoverflow.com/questions/2050343/programmatically-determining-space-available-from-unc-path [ ^ ]



接受的答案可能会映射一条路径,但我认为不必为了工作。另一个解决方案看起来也可行。
Personally, I have not done this directly, but this Stack Overflow question has two possible solutions for you:

http://stackoverflow.com/questions/2050343/programmatically-determining-space-available-from-unc-path[^]

The accepted answer might map a path, but I don't think it has to in order to work. The other solution also looks like it could work.


在pInvoke中使用GetDiskFreeSpaceEx(...)
Use GetDiskFreeSpaceEx(...) in pInvoke


我想我可能需要映射nas网络驱动器然后在完成时取消映射(之所以我得出这个结论主要是因为nas可能没有安装wmi),所以现在的问题是我该怎么做呢?
I figured that I may have to map the nas network drive then un map it when done (the reason why I came to this conclusion is mostly because the nas may not have a wmi installed on it), so the question now is how do I go about doing that?


这篇关于如何在UNC路径上找到可用空间\\serverName \ .....等。在c#中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆