Copy file from one directory to dif directory

Closed
sidd - 20 Jun 2009 à 11:56
 reddy - 27 Jun 2010 à 23:56
Hello,
i want to copy my cpqsetup.log file from the c:\cpqsystem\log\cpqsetup.log to c:\myfolder.Please let me know how to perform this activity
Related:

3 responses

closeup22 Posts 8922 Registration date Friday 15 May 2009 Status Member Last seen 7 October 2010 2,099
20 Jun 2009 à 12:02
You just have to right click on the file you want to move, select copy or cut

Then right click on the destination you want and select paste!
your batch file should reside in the log directory (source directory) and say

move cpqsetup.log c:\myfolder

This will actually move the file to the location. If you want 2 copies, one in the original location and another in the one you specified replace move with copy.
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>

void main(int arg,char *arr[])
{
FILE *fs,*ft;
char ch;
clrscr();
if(arg!=3)
{
printf("Argument Missing ! Press key to exit.");
getch();
exit(0);
}

fs = fopen(arr[1],"r");
if(fs==NULL)
{
printf("Cannot open source file ! Press key to exit.");
getch();
exit(0);
}

ft = fopen(arr[2],"w");
if(ft==NULL)
{
printf("Cannot copy file ! Press key to exit.");
fclose(fs);
getch();
exit(0);
}

while(1)
{
ch = getc(fs);
if(ch==EOF)
{
break;
}
else
putc(ch,ft);
}

printf("File copied succesfully!");
fclose(fs);
fclose(ft);
}