Monday, October 24, 2005

Create new directory programatically in c#

Here is the little code snippet which creates directory under inetpub/wwwroot folder
Code snippet:
foreach (string s in Directory.GetLogicalDrives())
{
//Find the drive I'm looking for
string sPath="" ;
sPath=s + "inetpub/wwwroot/";
if (Directory.Exists(sPath ))
{
DirectoryInfo r = new DirectoryInfo(sPath);
r.CreateSubdirectory("MyFolder");
}
}

plz feel free to deconstruct this code.

Happy Programming!!!

Regards,
Kamlesh

No comments: