Click to See Complete Forum and Search --> : Search for files using their formats


SIQ
July 27th, 2009, 12:55 PM
Hi and greeting to all

I have a small problem and i hope someone can help me through ur fruitful forums here, and please excuse my weak language.

I need to design a program that has some functionality intends to search for files using their formats. I have been advised to use the C++ WinAPI to be able using some function from Windows.

I do need any help to make the program search for all files that has the .INI format, as an example. After gathering these files i need them somehow to process some operations on them that i will handle later.

I appreciate ur cooperation.

My kind regards..

JVene
July 27th, 2009, 03:04 PM
The MSDN samples show how to use FindFirstFile and FindNextFile (and they have an "ex" version, too).

These allow you to supply wildcards to the search term, as in "*.ini".

The use of these is recursive, and I believe at least one sample shows that. In other words, when you get an entry and discover it is a directory, not a file, you'll perform a recursive search in that directory, continuing recursively in a fashion that searches all directories and subdirectories on a drive.

If you need to search all drives, you'll also need to search "getdrives" - it's a little uncomfortable at first, but it will reveal all of the drives on the system. You'll need to search each drive if "all drives" is your target interest.

golanshahar
August 4th, 2009, 11:58 PM
This FAQ (http://www.codeguru.com/forum/showthread.php?t=312461) might help.

Cheers