-
Notifications
You must be signed in to change notification settings - Fork 0
/
walkdir.c
58 lines (38 loc) · 881 Bytes
/
walkdir.c
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
/*
walkdir.c
goes through a subdir system noting number of image files dirs extracted later.
walk nftw
globals are:
int walkflag;
int dirstomake;
int filestoprocess;
char **dirlist;
*/
#include "ourdefs.h"
int walkdir(const char *file, const struct stat *sb,
int flag, struct FTW *s)
{
const char *name = file + s->base;
//static char dupfile[BUFFER];
//static char duppath[BUFFER];
// printf("%*s", s->level * 4, ""); /* indent over */
if ((s->level < 2)||(message==0)) // skip subdirs?
{
if (flag == FTW_F)
{
if (validtype(name, newdir, NULL, 2))
{
strcpy(filelist[filestoprocess++],file);
// strcpy(dupfile,file);
// strcpy(duppath,dirname(dupfile));
// if (strcmp(duppath,oldname)!=0)
// {
// dirstomake++;
// strcpy(dirlist[dirstomake-1],duppath);
// strcpy(oldname,duppath);
// }
}
}
}
return (0);
}