Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Directory + Sub Directories

Tags:

c#

I've got a directory location, how can I create all the directories? e.g. C:\Match\Upload will create both Match and the sub-directory Upload if it doesn't exist.

Using C# 3.0

Thanks

like image 963
Lennie Avatar asked Nov 05 '09 14:11

Lennie


People also ask

How do I create a sub directory in Unix?

The mkdir command in Linux/Unix allows users to create or make new directories. mkdir stands for “make directory.” With mkdir , you can also set permissions, create multiple directories (folders) at once, and much more.

How do I create a directory and sub directory in Linux in one command?

Answer: Creating directories on a linux system is done by use of mkdir command. Please note that Linux shell is case sensitive, therefore, temp and TEMP are two distinct directories. Below you can find a basic usage of the mkdir command.

Does mkdir create subdirectories?

Creation of an entire directory tree can be accomplished with the mkdir command, which (as its name suggests) is used to make directories. The -p option tells mkdir to create not only a subdirectory but also any of its parent directories that do not already exist.


1 Answers

Directory.CreateDirectory(@"C:\Match\Upload") will sort this all out for you. You don't need to create all the subdirectories! The create directory method creates all directories and sub directories for you.

like image 60
RichardOD Avatar answered Sep 29 '22 04:09

RichardOD