Recurse (advanced file searching in C++)

Background

The directory recursion class is an object oriented file search class for Microsoft Windows Operating Systems. It is easy to search for matching files at a single directory level in VB or Visual C++ using _findfirst() and _findnext() but not for multiple directory and full volume searching. This class makes it easy.

As far as I know Microsoft have never supplied the source code to a class that will work for all the conditions that the DOS 'dir' command does.

Requirements

IBM PC Compatible,
Windows 95/98/ME/NT4.0 or 2000,
Visual C++ 5 or 6 (nothing to stop it building on previous versions),

Idea

The specialisation of the recurse class for any purpose is done by inheritence of the basic recurse class. The foundHandler() function is marked as a virtual function so that it can be specialised in the derived class. foundHandler() acts as a callback for the recursion "engine".

Class diagram

Uses

An example application for this class is in a batch processing utility. l3batch.exe has been provided to show how command line programs can be executed by substitution of strings with matched file names.

A batch processing system can be setup to do neat things like call rmbatch.exe, the RealProducer command line convertor. rmbatch.exe cannot perform wildcard expansion in a single command, but using this utility we can make a system that can. Using this system any MP3 encoder could be batched, for example.

Programs that I have written using this class

Batch processor,
Duplicate file checking utility,
File integrity checking utility,
MP3 tag namer.

Build instructions

1. Load .dsw into Visual C++,
2. Goto Build\Rebuild All,
3. It should run.

Version history

20/7/2001 v0.6
1. Rebuilt and retested with Visual C++ 6 (no code changes),
2. Notes and sanity check batch file removed for final release.

18/11/1999 v0.5
1. Limited UNC expansion added,
2. Relative far directory file\directory name searching on another drive fixed.

17/10/1999 v0.4
1. Better debug build checks added,
2. Wildcard expansion corrected for when a drive letter appears in a file specification in a relative path.

13/10/1999 v0.3
1. listfiles() expansion rewritten for more conditions.

5/10/1999 v0.2
1. Dot and slash reduction added.

4/10/1999 v0.1
1. Basic version.

Back to index.