How can I get the list of files in a folder and all its subfolders using C or C++? -
this question has answer here:
- read file names directory 8 answers
- how can list of files in directory using c or c++? 18 answers
i want list of files in folder, if there subfolders inside, want list of files within these subfolders, too.
i have read question how can list of files in directory using c or c++?
didn't me solve problem.
all want function this:
vector<string> filelist; //return number of files within folder. // @ dir: folder directory // @ list: output list of files // @ filetype: multiple similar types int getfilelistfrom(const string & dir, vector<string>:: list, const string & filetype); int getfilelistfrom(const string & dir, vector<string>:: list, const vector<string> & filetypes);
i hope function can used follows (hypothetically):
//example1 filenum1 = getfilelistfrom("c:\\program files(x69)\\pornox", list1, "avi"); //example2 filenum2 = getfilelistfrom("d:\\myworkspace\\documentations\\", list2, vector<string>("doc","docx","pdf","txt"));
i'm using windows x86 system, don't worry cross-platform issue. also, if 3rd-part packages necessary, please provide download links , documentations.
any appreciated!
Comments
Post a Comment