File: md

package info (click to toggle)
stealth 1.45-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 716 kB
  • ctags: 175
  • sloc: cpp: 1,612; makefile: 88; sh: 70
file content (21 lines) | stat: -rw-r--r-- 454 bytes parent folder | download | duplicates (24)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// md: target should be a series of blank-delimited directories to be created
//     If an element is a whildcard, the directory will always be created,
//     using mkdir -p.
//
//     uses: run()

void md(string target)
{
    int idx;
    list paths;
    string dir;

    paths = strtok(target, " ");

    for (idx = sizeof(paths); idx--; )
    {
        dir = element(idx, paths);
        if (!exists(dir))
            run("mkdir -p " + dir);
    }
}