This is a discussion on How to find whether a folder exists or not using c#? within the C# Programming forums, part of the Software Development category; How to check a particular folder exsist or Not using c#?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| How to check a particular folder using c#? private bool CheckFolder(string targetFolder) { bool folderExists = Directory.Exists(targetFolder); if (!folderExists) { do something } else if (folderExists = "myfolderName") { DeleteFile(@\\myfolderName\); } return folderExists; } |
| |||
| We can check the folder exists or not in .Net 2.0 by using the following single line of code. Code: if (!Directory.Exists("C:/vinoth"))
{
Directory.CreateDirectory("C:/vinoth");
}
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Check to see if a cfwindow exists | BenR41 | ColdFusion Programming | 2 | 06-24-2008 12:17 AM |
| pagination for a folder? | saravanan | PHP Programming | 0 | 03-21-2008 04:53 AM |
| CON Folder in Windows | Sabari | Server Management | 1 | 12-01-2007 02:40 AM |
| Can we put the reference dll in to a specific folder? | amansundar | C# Programming | 3 | 10-28-2007 11:51 PM |
| Using C# and VB.NET classes together in the App_Code folder | Gopisoft | VB.NET Programming | 0 | 07-17-2007 09:39 PM |