This topic is now archived and is closed to further replies.

List of files in a directory?

This topic is 5132 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You need to look up three specific Win32 functions: FindFirstFile, FindNextFile and FileClose. FindFirstFile takes the directory name and a WIN32_FIND_DATA structure, and returns a file handle to the directory. You can use a do while loop, with FindNextFile as the condition, to loop through all the directories and files in the directory, and use the contents of the WIN32_FIND_DATA structure each time to determine if what''s found is a directory or a file, it''s name, creation date, and other details. Simply call FileClose with the handle to finish reading that directory.

The argument you specify to FindFirstFile also specifies the file type to search for, eg. "c:\\mydir\\*.*", or "c:\\mydir\\*.txt". If you need any more info, drop a post here...

Insert [CENSORED] here.

Share this post

Link to post
Share on other sites