Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <locale.h>
  3. #include <stdlib.h>
  4. #include <unistd.h>
  5. #include <limits.h>
  6.  
  7. int main()
  8. {
  9.     setlocale(LC_ALL, "Portuguese, Brasil");
  10.     int formandos, i, contrato;
  11.     printf("Numero do Contrato:" );
  12.     scanf("%d" ,&contrato);
  13.     printf("Numero de Formandos(pastas):" );
  14.     scanf("%d" ,&formandos);
  15.  
  16. //método pra dar get no diretório atual (album)
  17.     char* cwd;
  18.         char buff[PATH_MAX + 1];
  19.         cwd = getcwd( buff,PATH_MAX + 1 );
  20.  
  21. //cria album da instituição e pastas extras
  22.     snprintf(buf, sizeof(buf), "mkdir \"%d (0)\"",contrato);
  23.         system(buf);
  24.         system("mkdir \"Decoração\"");
  25.         system("mkdir \"Descarte Geral\"");
  26.         system("mkdir \"Fotos de Turma\"");
  27.  
  28.  
  29. //loop criação das pastas
  30.     for ( i = 1;i <= formandos; i++){
  31.         int i_formando = i;
  32.         snprintf(buf, sizeof(buf), "mkdir \"%d (%d)\" && cd \"%d (%d)\" && mkdir Descarte ",contrato,i_formando, contrato, i_formando);
  33.         system(buf);
  34.         printf("Formando %d criado. ",i_formando);
  35.         //vincula icones
  36.         snprintf(buf, sizeof( buf), "cd %d (%d) && echo [.ShellClassInfo] >> desktop.ini && echo IconResource=%s\\Icones\\%d (%d).ico,0 >> desktop.ini && attrib +s +h +r desktop.ini && cd .. && attrib +s +r \"%d (%d)\" ",contrato,i_formando,cwd,contrato,i_formando,contrato,i_formando);
  37.         system(buf);
  38.         printf("Ícone Vinculado\n"); }
  39. //fim loop
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement