windows - Optimize Disk Enumeration and File Listing C++ -
i writing c++ code enumerate whole hdd , drive listing, takes more 15 minutes complete disk enumeration of drives (hdd capacity 500gb). , compile response in binary file.
however, have 3rd party executable gives me listing of whole disk in less 2 minutes ... can please code , suggest me performance improvement techniques.
enumfiles(cstring folderpath, cstring searchparameter,win32_find_dataw *fileinfodata) { cstring searchfile = folderpath + searchparameter; cstring filename; hfile = findfirstfilew(searchfile, fileinfodata); // \\?\c:\* if (hfile == invalid_handle_value) { // error } else { { filename = fileinfodata->cfilename; if (fileinfodata->dwfileattributes & file_attribute_directory) { if (! (filename == l"." || filename == l"..")) { // save folder information enumfiles(folderpath + filename +(l"\\"), searchparameter,fileinfodata); } } else { // save file parameters } } while (findnextfilew(hfile, fileinfodata)); } findclose(hfile); }
Comments
Post a Comment