21 {
22 struct stat StatBuffer;
23
24 lstat(FileName.c_str(),&StatBuffer);
25 if((StatBuffer.st_mode & S_IFDIR) == -1)
26 {
27 cout << «could not get stats on file» << endl;
28 return(0);
29 }
30 else{
31 if(StatBuffer.st_mode & S_IFREG){
32 return(1);
33 }
34 }
35 return(0);
36 }
37
38
39 void depthFirstTraversal(const char *CurrentDir)
40 {
41 DIR *DirP;
42 string Temp;
43 string FileName;
44 struct dirent *EntryP;
45 chdir(CurrentDir);
46 cout << «Searching Directory: " << CurrentDir << endl;
47 DirP = opendir(CurrentDir);
48
49 if(DirP == NULL){
50 cout << «could not open file» << endl;