How to create a folder in a remote computer in c#

  • Thread starter Thread starter Omar
  • Start date Start date
O

Omar

Hi,

i want to create a folder in remote computer in c# without using WMI.

any help?

thanks.
 
You should be able to access the folder as
\\servername\sharename\foldername\newfolder
So do:
Directory.CreateDirectory(@"\\servername\sharename\foldername\newfolder");
 
Hi Ciaran,

I have a similar reqwuirement so i tried your solution below for creating
the directory but couldn't.

I have added myself under administrator group of hydhtc91670 m/c and have
wriiten the following code to create NewFolder_123 on that m/c.

Directory.CreateDirectory(@"\\hydhtc91670\mpIH\mpIH_deployables\NewFolder_123");

I am getting following error
"The network path was not found".

Does the issue lie with permission i need on that particular m/c. If so what
extra permissions i need to have on that m/c.

Rgrds,
Earla
 
You might have to check that the rest of the path Exists. If you want to
create more than one level of directories, i.e. \\hydhtc91670\mpIH\ is empty
and you want to make mpIH_deployables then make NewFolder_123 inside it, you
would need to create them in turn.
If this isnt the case, check the permissions on the share to ensure remote
users have access to modify and create folders.
 
Back
Top