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 www.codeguru.com and other basics one.
Question by:nurein
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…

600 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