#include<io.h> #include<iostream> #include<string> #include<fstream> using namespace std; void dfsFolder(string folderPath, ofstream &fout) { _finddata_t FileInfo; string strfind = folderPath + "\\*"; long Handle = _findfirst(strfind.c_str(), &FileInfo); if (Handle == -1L) { cerr << "can not match the folder path" << endl; exit(-1); } do{ if (FileInfo.attrib & _A_SUBDIR) { if( (strcmp(FileInfo.name,".") != 0 ) &&(strcmp(FileInfo.name,"..") != 0)) //this sentence!// { string newPath = folderPath + "\\" + FileInfo.name; dfsFolder(newPath, fout); } } else { fout << folderPath << "\\" << FileInfo.name << " "; } }while (_findnext(Handle, &FileInfo) == 0); _findclose(Handle); fout.close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)