
                         TreeDo/Command line utility
          Traverses dir tree, performing supplied command in each dir.

                      mikel@networx.com <Mike Lempriere>

Created Feb-93,
Initial submission to Hobbes, ver 1.1, 26-Nov-94

------------------------------------------------------------------------------

WHAT IT DOES:

  TREEDO is a simple command line program that does a command through all
  subdirs, with some dir substitution capabilities and knowledge of MAKE.

  As an example, the following will delete all *.tmp files on your C: drive:

      C:
      cd \
      treedo -v del %p\*.tmp

  It can be used like the unix "find . -type d -name -exec {}".

------------------------------------------------------------------------------

INSTALLATION:

  Merely unpack TREEDO.ZIP, then move TREEDO.EXE to a dir on your path.
  I'd recommend moving TREEDO.TXT (this file) to the same dir so you can
  find it later (unless you have a dir of loose docs, put it there).
  TREEDO is a C++ program; the complete source file TREEDO.CPP is included
  in the zip file in case you're inclined to look at the source, as is a
  simple Makefile for building it.  They are not needed to run the program.
  There are no other support files used or needed for running or building.

------------------------------------------------------------------------------

LICENSE JUNK:

  There are no requirements for using this program.

  Of course there are also no warranties.

  I do ask, however, that if you have Internet e-mail access, you drop me
  a line of thanks (or criticism if you have suggestions/bug-reports).
  Also indicate in your mail if you'd like to be notified of any future
  renditions.

  If you find a bug (unlikely, as I've used it continuously for over a
  year), please e-mail me about it.  If you make any mods to the source,
  please e-mail them to me so that I can incorporate them into any future
  renditions.  If you have any suggestions for improvements to TREEDO,
  I'd especially like to hear them, e-mail me; mikel@networx.com.

------------------------------------------------------------------------------

USAGE:

  I wrote this program originally to perform a MAKE in all subdirs so as to
  build a large software product in an automated fashion.  However, it's
  not tied to make, I left it generic so that it can perform any command
  supplied in all subdirs.

  A very simple example of what it does, is to simply type:

      C:
      cd \
      treedo cd

  It will then perform the CD command in each dir on your C: drive, thus
  listing them all out to your screen.  (It's fine to hit ctrl-C if you
  don't want to watch them all go by.)

  It can be started anywhere without actually having to CD there (-s),
  display each dir as it goes (-v), only execute at a lowest level dir (-l),
  only go into dirs with a certain file (-e), or only go into dirs with a
  specific text file containing a specific command (-m).  It can supply the
  drive and/or dir of the dir it's working in to the command (%d, %p).  And
  of course, it can take any command.  It can also dup2() stderr to stdout.

------------------------------------------------------------------------------

COMMAND SUMMARY:

  Usage: [switches] command [args]

  -h, -?  This usage screen.
  -v      Verbose mode -- displays each dirname before performing command.
  -o      dup Output mode -- copies stderr to stdout.
  -l      Leaves only mode -- Only performs coommand in bottommost dirs.
  -n      No recurse -- does not go into subdirs.  This is useful
          for breaking up the CWD pathname.
  -s path Set initial drive & dir.
  -m f p  Special check for 'Make'.  This checks each dir for file 'f', and, if
          it exists, checks for pattern 'p' in that file.  If both conditions
          are met, performs the given command, else dir. will be skipped.
          Note that pattern is assumed to be anchored left, and is a simple
          char-by-char match (no wildcards) -- not a Regular Expression!
  -e f    Check for file Existance.  This checks each dir for file 'f', and, if
          it exists, performs the given command, else dir. will be skipped.

  Special args:
  %d      current working drive
  %p      current working directory (without drive)

  All unrecognized args will be passed to the new subshell as the command
  to perform and its args.  Note that 'stderr' is dup'ed to 'stdout' for
  all child processes.

------------------------------------------------------------
  EXAMPLES:

    Get a file listing for all dirs below this one:

        treedo dir > dirlist.txt


    For every dir below this one, if there is a 'makefile.dos',
    and it has a 'lib:' rule, perform that make, displaying each
    dir name as we go, with stderr in the redirected output file:

        treedo -o -v -m makefile.dos lib: make -f makefile.dos lib > make.err


    Delete every file named 'core' on the entire D: drive, without
    bothering to go there first:

        treedo -s D:\ -e core del core


    Duplicate dir structure on D: drive:

        treedo -v mkdir D:%p


    Send current drive and dir to a command as args:

        treedo -n echo %d %p


    Dup stderr to stdout for compile/link output redirection:

        treedo -o -n bcc -Dos2 treedo >treedo.err

        (This is the same as)
        bcc -Dos2 treedo 2>&1 > treedo.err
        (under OS/2, but is not possible under DOS.)


    Find all files named config.sys on drive D:

        treedo -v -s D:\ dir /b config.sys 2>nul

------------------------------------------------------------------------------

PORTING:

  The original DOS code compiled fine under Borland's OS/2 compiler by adding
  a "-Dos2" to the command line and some trivial "#ifdef"s.  Unfortunately,
  DOS compatibility was lost in porting to IBM's CSET++, as it now uses the
  OS/2 DosFindFirst() call directly, instead of Borland's 'find_t' struct and
  _dosfindfirst() call.  As I no longer have access to a Borland DOS
  compiler, I'm not able to go back and get the DOS rendition working.
  (Note: Courtesy jernst@vnet.ibm.com, the supplied source has been confirmed
  to compile/link/run on DOS under Borland 3.1.)

  The supplied .exe was built with Borland's C++ 1.00 for OS/2.  The source
  has also been compiled/linked/used extensively under IBM CSET++ 2.0.

  It was originally written under DOS (Borland 3.1 compiler), to deal with
  Borland compiler/linker/librarian etc. output, which write some output to
  stdout, and some to stderr.  As DOS has no way of combining the two
  streams from the command shell, TREEDO does this for all child processes
  by means of dup2(1, 2) if the -o switch is supplied.  Under OS/2 this
  functionality is less important as "2>&1" works in the command shell.

  If you do get it to compile on any compiler not mentioned, please let me
  know (e-mail mikel@networx.com), especially if you had to make changes.

  The included Makefile has commented out lines in it for Borland, just
  edit it, commenting out the IBM CSET lines, uncommenting the Borland.
  You can also use "make clean" to get rid of the .obj, .map, etc. files.

  The code is completely warning free.  If you get warnings from some
  other compiler, I'd love to have them fixed, please let me know.

------------------------------------------------------------------------------
