Click here to Skip to main content
15,893,663 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi guys, I have a code here that creates folder. but i want to create a folder in an existing folder..

is it possible?

Thanks in advance..

VB
Dim appPath As String = Request.PhysicalApplicationPath.ToString()
Dim newnewDirectory As New DirectoryInfo(appPath + TextBox_host_remarks.Text)
newnewDirectory.Create()
Posted
Updated 14-Oct-14 16:44pm
v4
Comments
George Jonsson 14-Oct-14 22:39pm    
It is possible. Just specify the path, like Directory.Create(@"C:\ExistingFolder\MyNewFolder");
NekoNao 14-Oct-14 22:41pm    
like this ? newnewDirectory.Create(@"C:\ExistingFolder\MyNewFolder") ?
Sergey Alexandrovich Kryukov 15-Oct-14 0:01am    
I guess, truth repeated twice becomes... clearer. :-)
—SA
Sergey Alexandrovich Kryukov 15-Oct-14 0:12am    
May I ask you, what's wrong with just reading original MSDN documentation?
—SA

1 solution

You can do this via the static method
VB
Directory.CreateDirectory(@"C:\ExistingFolder\MyNewFolder");

Directory.CreateDirectory Method[^]

Or you can use DirectoryInfo DirectoryInfo.CreateSubdirectory Method[^]

There are pretty good examples at MSDN you can follow. See the links above.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 15-Oct-14 0:02am    
Sure, a 5.
—SA
George Jonsson 15-Oct-14 1:21am    
Thanks Sergey.

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



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