Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/stat.h>
- int main(int argc, char *argv[])
- {
- short i;
- struct stat directory = {0};
- if (argc < 2) {
- fprintf(stderr, "Usage: mkdir directories\n");
- exit(-1);
- }
- else {
- for (i = 1; i < argc; i++) {
- if (stat(argv[i], &directory) != -1)
- fprintf(stderr, "%s already exists", argv[i]);
- else
- mkdir(argv[i], 0777);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement