Directly on the code
Test_max.cpp: Defines the entry point of the console application. #include "stdafx.h" #include <windows.h> #include <Shlwapi.h> #include <iostream> #include < string> #include <vector> #pragma comment (lib, "Shlwapi.lib")//Note the placement of the position using namespace Std;void findfile ( String dir) {Win32_find_dataa stfd;//The structure that holds the file information handle h;string temp;temp=dir+ "\\*"; H=findfirstfilea (Temp.c_str (), &STFD);//build directory handle while (Findnextfilea (H,&STFD))//extract directory handle corresponding directory contains file {temp=dir+ "\ \" +stfd.cfilename;if (temp== dir+ "\ \.") Upper-level path {continue;} else if (Pathisdirectorya (Temp.c_str ()))//contains subdirectories {findfile (temp);//Recursive call}else{cout<<stfd.cfilename<< endl;//print file name}}return;} int main (void) {string dir;dir= "F:\\datasets\\match gallery"; FindFile (dir); system ("pause"); return 0;}
You can do what you want after you know the file name and path name