使用C#检查给定目录和文件是否共享 [英] Check that give directory and file is shared or not using C#

查看:99
本文介绍了使用C#检查给定目录和文件是否共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正在尝试检查给定目录或文件是否在网络中共享.
我还想检查共享目录或文件上的权限.

预先感谢

Hi Every One

I am trying to check that whether a given directory or file is shared in network or not.
I also want to check the permission given on the shared directory or file.

Thanks in advance

推荐答案

是的,如果您愿意使用WMI,这将非常容易.参见:

http://stackoverflow.com/questions/136539/determining-if- a-folder-is-shared-in-net [ ^ ]

还要注意,您不共享文件,而是共享文件所在的文件夹.
Yes you can, and it''s fairly easy if you are open to using WMI. See:

http://stackoverflow.com/questions/136539/determining-if-a-folder-is-shared-in-net[^]

Also note that you don''t share a file, you share the folder it resides in.


如果您询问是否可以确定是否存在本地文件/文件夹分享,不,我认为您不能.

如果您询问是否可以确定给定的远程文件夹/文件是否为共享,可以.您甚至可以确定它是否是连接的共享以及权限是什么.我非常确定WMI将允许您执行所有操作.
If you''re asking whether or not you cand tell if a local file/folder is shared, no, I don''t think you can.

If you''re asking if you can tell if a given remote folder/file is a share, yes you can. You can even determine if it''s a connected share, and what the permissions are. I''m pretty sure that WMI will allow you to do all that.


这篇关于使用C#检查给定目录和文件是否共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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