-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate_dir.cpp
More file actions
36 lines (32 loc) · 1.03 KB
/
Copy pathcreate_dir.cpp
File metadata and controls
36 lines (32 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//**********************************************************************
// Header file Included
//**********************************************************************
#include "myheader.h"
//**********************************************************************
// This Function used to create directory(s)
//**********************************************************************
void makeDirectories(vector<string> list)
{
unsigned int len = list.size();
if (list.size() <= 2)
{
showError("Lesser Number of Argument in create_dir!!!");
}
else
{
string destpath = pathProcessing(list[len - 1]);
// cout<<"\ndestpath : "<<destpath<<endl;
for (unsigned int i = 1; i < len - 1; i++)
{
string dir = destpath + "/" + list[i];
char *path = new char[dir.length() + 1];
strcpy(path, dir.c_str());
// cout<<"\nmkdir name :"<<dir<<endl;
int status = mkdir(path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
if (-1 == status)
{
showError("Error in creating the Directory in path ::::: " + string(path));
}
}
}
}