April 24, 2013

Copying folders and files

06:34 Posted by Unknown , 3 comments
#include<stdio.h>
#include<stdlib.h>
int main ()
   {
 int i;
 printf ("\n");
 i = system(" XCOPY [source path] [destination path] [options] ");
 printf ("Returned value is: %d.\n",i);
        return 0;
   }

Copy files and/or directories to another folder. XCOPY is similar to the COPY
command except that it has additional switches to specify both the source and destination in detail.
options:
/s ----copy folders and subfolders
/u----copy files that already exists in the destination
/e----copy folders and subfolders including empty folders
/h----copy hidden folders and files
/a----copy files with the archive attribute set
/D:mm-dd--yyyy ---- Copy files changed on or after the specified date.If no date is given, copy only files whose source date/time is newer than the destination time.

For more options goto

3 comments:

  1. Do we have to leave the pre processor directives just like, #inlclude or do we have to add #include ??

    ReplyDelete
    Replies
    1. I have updated the code check it now..


      Delete
    2. Thanks for pointing out...we must have #include "stdlib.h" because we are using system function here...and #include "stdio.h" because we are using standard input output functions like printf().....

      For better understanding of system function() check out older post

      It's just a editing mistake while highlighting the code.....

      Delete

Please Enter your comment here......