Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Filefind filecopy and MCSD

Posted on 1999-07-21
Medium Priority
Last Modified: 2013-11-20
Hello all,
I am a newbiew in VC++5 and i'm looking for a source code which will enable me to find files (C:\) i.e all *.doc and copy the found files to C:\Mydocuments.  Please advise with working source code.  Also i need a good MCSD resource and VC++ Resources on the internet.  I know and other basics one.
Question by:nurein
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

malmq earned 40 total points
ID: 1310819
Use the CFileFind class.  The sample is for directories but it could be quickly modified for files.


This small program recurses every directory on the C:\ drive and prints the name of the directory.

#include <afx.h>
#include <iostream>

using namespace std;

void Recurse(LPCTSTR pstr)
   CFileFind finder;

   // build a string with wildcards
   CString strWildcard(pstr);
   strWildcard += _T("\\*.*");

   // start working for files
   BOOL bWorking = finder.FindFile(strWildcard);

   while (bWorking)
      bWorking = finder.FindNextFile();

      // skip . and .. files; otherwise, we'd
      // recur infinitely!

      if (finder.IsDots())

      // if it's a directory, recursively search it

      if (finder.IsDirectory())
         CString str = finder.GetFilePath();
         cout << (LPCTSTR) str << endl;


void main()
   if (!AfxWinInit(GetModuleHandle(NULL), NULL, GetCommandLine(), 0)
      cout << "panic!" << endl;


Author Comment

ID: 1310820
Any good site for MCSD Stuff?


Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question