Copy file from one directory to dif directory

Closed
sidd - Jun 20, 2009 at 11:56 AM
 reddy - Jun 27, 2010 at 11:56 PM
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 May 15, 2009 Status Member Last seen October 7, 2010 2,099
Jun 20, 2009 at 12:02 PM
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!
3
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.
3
#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);
}
1