C#/.NET: Check if Folder exists
Tutorial by Guest | 2016-06-14 at 15:04
If we need a folder in our application and we do not know whether this directory is already existing, we can just ask the system and check for the existence of this folder.
string folder = @"C:\TestFolder"; if (!Directory.Exists(folder) { // create the folder } else { // folder exists }
We can do that with special folders and each other type of directory. You can also do that with multiple folders when creating a folder list and going through it with the help of foreach.
More about that in another tutorial.
About the Author
The author has not added a profile short description yet.
Show Profile
Related Topics
MIME Types of Microsoft Office File Formats
Info | 0 Comments
SQLite: Check whether Table exists
Info | 0 Comments
Rename File to its Folder Name
Tutorial | 0 Comments
XAMPP: How to set up SSL/HTTPS for local Projects
Tutorial | 4 Comments
Windows Batch Script: Computer Shutdown
Tutorial | 2 Comments
Create virtual domains for Apache/XAMPP
Tutorial | 2 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.