Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
888
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #include <sys/stat.h>
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8. short i;
  9. struct stat directory = {0};
  10.  
  11. if (argc < 2) {
  12. fprintf(stderr, "Usage: mkdir directories\n");
  13. exit(-1);
  14. }
  15.  
  16. else {
  17. for (i = 1; i < argc; i++) {
  18. if (stat(argv[i], &directory) != -1)
  19. fprintf(stderr, "%s already exists", argv[i]);
  20.  
  21. else
  22. mkdir(argv[i], 0777);
  23. }
  24. }
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement