Click here to Skip to main content
14,454,989 members
Rate this:
Please Sign up or sign in to vote.
See more:
i need to scan a drive for eg drive F i want to scan all folders which means subfolders
so it needs to be a recursive function so that it can itrate over every subfolder in a folder and get the names and path of these specific .mp3 files and save in a text file
its very easy to do in linux but unfortunately i have to do this on window i know i need t use wind32 api and use findFirstFile function and etc
looking forard for answer
for now i have this code only

What I have tried:

BOOL WINAPI rd_cb(TCHAR *file_path, VOID *param)
TCHAR *exts;
exts = param;
while (*exts) {
TCHAR *cur_ext;
cur_ext = PathFindExtension(file_path);
if (cur_ext) {
if (_tcscmp(cur_ext, exts) == 0) {
/* do what you want here with the file */
/* printf as an example here */
_tprintf(TEXT("%s\n"), file_path);

return TRUE;
Updated 4 days ago

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

I would start with the sample code gently provided by The Documentation[^].
OriginalGriff 14-Feb-20 3:28am
A very polite RTFM! :)
CPallini 14-Feb-20 3:44am
"i already have read all the microsoft documentation regarding this"
Then you are more than competent to write the recursive variant of such code sample.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100