Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFileFind

Status
Not open for further replies.

joeGrammar

Programmer
Jun 4, 2001
162
0
0
CA
CFileFind is a great little tool if you have a large list of files you'd like to change the extension to. You don't even have to specify anything on the command line.

All you have to do is create a console application with MFC support, create a CFileFind variable and use it as such:

bool var = finder.FindFile("*.dat")

/* This will find all files with this particular extension
in the current directory(including directory names) */

All you then have to do is create a while statement as such:

while(var)

and within it use such functions in the CFileFind class as:

FindNextFile and
GetFileName /*returns a CString*/

and finally use the MFC rename(char*,const char*) function to rename the found file to whatever you wish



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top