Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
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
Posted
Updated 19-Oct-10 1:53am
v2
Comments
Sandeep Mewara 19-Oct-10 7:53am    
Ok. Now what's your issue?

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.
 
Share this answer
 
Comments
Indresh1210 19-Oct-10 8:50am    
Hi

Nishant

I checked the link but in query I want to pass the path of the given folder dont want to fetch all the shared folders. On passing the path of the folder it is giving me error. And I have to find out that in the given path all the directories are shared or not means all the directorie and sub directories.
Eg
E:\abc\def\efg
in this path ia have to check whether 'efg' shared or not then 'def' then 'abc' and finaly E drive


Thanks
Nish Nishant 19-Oct-10 8:53am    
There is no such API as far as I know. You have to get all the shares and then manually parse them to see if your directory is shared or not.
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.
 
Share this answer
 
Comments
Indresh1210 19-Oct-10 8:51am    
HiJohn Simmon

I wanted to check it on local machine Whether the Directory or the File is shared in network or not ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900