How can I create multiple directories in a single line?

138 Views Asked by At

I want to know the source code: how can I create multiple directories using Turbo C++. For example, you can see in MS-DOS, in a single line:

md a b c d

creates a, b, c, and d directories simultaneously.

I have used this code in Turbo C++ (Borland Compiler 5.5):

char dir_name[256];
int status=mkdir(dir_name);
if(status==0)
{
    cout<<"Directory created.";
}
else
{
    cout<<"Error!";
}

Can anybody help me out, please...?

1

There are 1 best solutions below

0
On

You can store the names in a 2-day array the names can be entered in a single line by delimiting them using space and then using a loop create directories till you reach the end of your array.