home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / c / csh4.zip / BACKUP.C < prev    next >
C/C++ Source or Header  |  1985-09-03  |  476b  |  27 lines

  1. #include <stdio.h>
  2. char buf[256];
  3. char buf2[256];
  4.  
  5. main()
  6. {
  7.     char *gets(),*rindex();
  8.     char *patch;
  9.     while(gets(buf))
  10.     {
  11.         patch = rindex(buf,'\\');
  12.         *(++patch) = '\0';
  13.         sprintf(buf2,"d:%s",buf);
  14.         *rindex(buf2,'\\') = '\0';
  15.         if (-1 == mkdir(buf2))
  16.         {
  17.             fprintf(stderr,"cant make %s\n",buf2);
  18.             continue;
  19.         }
  20.         sprintf(buf2,"cp %s*.* d:%s",buf,buf);
  21.         fprintf(stderr,buf2);
  22.         write(2,"\r\n",2);
  23.         *rindex(buf2,'\\') = '\0';
  24.         system(buf2);
  25.     }
  26. }
  27.