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

O

Omar

Hi,

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

any help?

thanks.
 
C

Ciaran O''Donnell

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

Pradeep Earla

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
 
C

Ciaran O''Donnell

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top