-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate_dir.cpp
More file actions
38 lines (34 loc) · 1.22 KB
/
create_dir.cpp
File metadata and controls
38 lines (34 loc) · 1.22 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
37
38
/************************************************************************
** RollNo:2018201033 Name : Darshan Kansagara **
************************************************************************/
//**********************************************************************
// 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));
}
}
}
}