- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a Directory using C#?
To create, move and delete directories in C#, the System.IO.Directory class has methods.
Firstly, import the System.IO namespace.
Now, use the Director.CreateDirectory() method to create a directory in the specified path −
string myDir = @"D:\NEW"; if (!Directory.Exists(myDir)) { Directory.CreateDirectory(myDir); }
In the same way, you can create a sub-directory −
string mysubdir = @"C:\NEW\my\"; Directory.CreateDirectory(mysubdir);
- Related Articles
- How to create a directory using Java?
- How to create a directory using Python?
- How to create a directory hierarchy using Java?
- How to create a Directory recursively using Java?
- How to create a directory recursively using Python?
- How to create a unique directory name using Python?
- How to create a directory in project folder using Java?
- How to create a zip archive of a directory using Python?
- How can I create directory tree using C++ in Linux?
- How to create a new directory in Linux using the terminal?
- How to create a new directory by using File object in Java?
- How to create bulk users in the active directory using PowerShell?
- How to remove a directory using Python?
- How to create a symbolic link to a directory in Ubuntu?
- How to create directory programmatically in Android?

Advertisements