12 main(int argc
, char *argv
[])
16 struct dirent
*dirent
;
19 fprintf(stderr
, "Usage: %s SRC DST\n", argv
[0]);
23 sdir
= opendir(argv
[1]);
25 fprintf(stderr
, "Failed to open %s: %s\n",
26 argv
[1], strerror(errno
));
30 tfd
= open(argv
[2], O_DIRECTORY
);
32 fprintf(stderr
, "Failed to open %s: %s\n",
33 argv
[2], strerror(errno
));
38 while ((dirent
= readdir(sdir
)) != NULL
) {
39 if (dirent
->d_name
[0] == '.' &&
40 (dirent
->d_name
[1] == '.' || dirent
->d_name
[1] == '\0'))
43 int fd
= openat(tfd
, dirent
->d_name
, O_CREAT
|O_WRONLY
, 0666);
45 fprintf(stderr
, "Failed to create %s/%s: %s\n",
46 argv
[2], dirent
->d_name
, strerror(errno
));