-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathf2a_mvall.c
More file actions
50 lines (30 loc) · 844 Bytes
/
f2a_mvall.c
File metadata and controls
50 lines (30 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// implement move all command..
//working on...
#include<stdio.h>
#include<stdlib.h>
void main(int argc,char **argv)
{
//char ch,str[1000];
char ch,str[1000];
int s;
FILE *fl,*fs,*fd;
system("ls -a > ls.txt");
//if( strcmp(argv[1],"--help")==0 )
//printf("Usage: mv [OPTION]... [-T] SOURCE DEST\nor: mv [OPTION]... SOURCE... DIRECTORY\nor: mv [OPTION]... -t DIRECTORY SOURCE...\nRename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n");
if(argc<2)
{
printf("Invalid usage: mvall destination\n");
}
fl=fopen("ls.txt","r");
//we can use touch for multi file creation at destination..
while( (fscanf(fl,"%[^\n]",str)) )
{
fs=fopen(str,"r");
fd=fopen(argv[1]/str,"w"); //working...
while( (ch=fgetc(fs))!=-1 )
fputc(ch,fd);
remove(argv[1]);
//s=remove(argv[1]);
//if(s==0)
//printf("File moved successfully.\n",argv[1]);
}