DO 1.30 for OS/2                      Martin Vieregg, Germany
Freeware                              info2006 at hypermake.de
                                      August 2006

Homepage:
http://www.hypermake.com

                             DO.EXE 1.30

           commandline program with a set of functions
            

DO.EXE is a set of very useful batch enhancements and command-line utilities. 
This version replaces a handful of old freeware exe programs which stopped 
running properly due to integer overflow. DO.EXE also works if the results 
are larger than 32 bits, e.g. free disk space larger than 4 GB. I have 
written DO.EXE with Sibyl (Pascal). If you would like to see any functions 
added, please send me your suggestions.

DO.EXE is available for Win32 and OS/2.
             

----------- Installation ---------

Copy DO.EXE into a directory of your PATH statement.

If you use other third-party commandline windows, your environment may
not accept this DO.EXE because DO is part of the batch file language.
Just rename DO.EXE in this case. 

OS/2 only: Make sure that you have the EMX libraries installed.
Please visit ftp://ftp-os2.nmsu.edu/pub/os2/dev/emx/v0.9d

------------ Online Help ---------

Simply type DO without parameters.


------------ version history ----------


1.01: * wildcard at the end of expression ABC* did not work
1.02: new commands DO WAITFORDRIVE, DO ISDRIVEREADY, DO SOUND added
1.03: WHICHFIRST added
1.10: some bugfixes; (OS/2 only) moved from kbdvio32.dll to emx.dll
      DO BATCH added
1.11, 1.12: minor bugfix
1.20: DO DELETE added
1.30: long file support > 2 GB added both for Windows and OS/2
      Return values for DO WHICH
------------ Functionality and usage ---------------

General Syntax:

DO COMMANDNAME [.] [WILDCARD1 WILDCARD2...] [COMMANDPARAMETER]

For most commands, you can type wildcard filenames. The default behaviour 
of DO is to run through all subdirectories. A single dot omits subdirs.

DO writes the output to stdout and does not use escape sequences, so 
you may route the output to a text file: 

[C:\] DO LISTDIR >Directories.txt

creates a file "Directories.txt" containing all directory names
of drive C:


Functions:

*************
** drives ***
*************

DO DISKFREE D: shows the free disk space of disk D:
DO DISKSIZE D: shows the size of disk D:
DO DISKINFO D: shows free disk space and size of disk D: 
               and ?: shows all drives

sample:
[C:\] do diskinfo ?:
Drive C: 187 MB free (37%) of total 502 MB disk space
Drive D: 149 MB free (19%) of total 792 MB disk space
Drive E: 62.8 MB free (8%) of total 792 MB disk space

All sizes are shown with three valid digits, e.g. 99.9 MB or 111 GB.

******************
** directories ***
******************

DO LISTDIR  lists all directories
DO SIZE D:\DIRECTORY
            shows the size of all files in the directory (with subdirs)
DO TREE     shows a directory tree

samples:
[C:\mydata] search\do size
Size of C:\mydata\*.* is 310 MB

[C:\mydata] search\do listdir
C:\mydata\mydir1
C:\mydata\mydir2
C:\mydata\mydir2\mysubdir1
C:\mydata\mydir2\mysubdir2

[C:\mydata] do tree
mydir1
mydir2
   mysubdir1
   mysubdir2

*******************
** showing files **
*******************
            
DO LIST     shows full file name of all files
DO LISTSIZE shows full file name and size of all files
DO LISTSIZEDATE shows full file name, size and date

sample:
[C:\mydata] do list
C:\mydata\mydir1\file1.txt
C:\mydata\mydir1\file2.cpp
C:\mydata\mydir2\mysubdir1\file1.txt
C:\mydata\mydir2\mysubdir1\file2.cpp
C:\mydata\mydir2\mysubdir2\file1.txt
C:\mydata\mydir2\mysubdir2\file2.cpp

[C:\mydata\mydir1] do list .
C:\mydata\mydir1\file1.txt
C:\mydata\mydir1\file2.cpp

[C:\mydata\mydir1] do list . *.cpp
C:\mydata\mydir1\file2.cpp

[C:\mydata\mydir1] do listsizedate . *.cpp
C:\mydata\mydir1\file2.cpp (23.4 kB; 7-22-2003)

DO TYPE *.TXT prints all *.TXT files to stdout (with subdirs)

"DO TYPE" is similar to the default "TYPE" command, but runs through all
subdirectories:

[H:\prog] do type *.c *.cpp >AllMyCfiles.txt

creates a big text file with the contents of all C and CPP text files
located in the H:\prog directory, including subdirectories.

Please note that such a command creates very big text files. Not every
text editor is able to handle such files. I've written a powerful
freeware editor "WSedit" which handles files up to 20 MB length.
Visit http://www.WriteAndSet.com

*****************
** text search **
*****************
            
DO SEARCH String1 String2 ...  searches String1 or String2 ...
DO SEARCHLIST writes only the filename, not the occurences of the string

samples:
[H:\prog] do search *.cpp "void mess"
H:\prog\4allcalc\messrec.cpp
(48) void MessRecStart () {
(53) void MessRecEnd () {
H:\prog\sibyl\Ctest\messrec.cpp
(48) void MessRecStart () {
(53) void MessRecEnd () {

The line number is shown in parenthesis. If you want to see only the
filenames and not the line occurrences, type SEARCHLIST instead of SEARCH.

[H:\prog] do search *.pas *.cpp void OR procedure
shows all lines in *.pas and *.cpp files (also in subdirectories) which
contain the expressions "void" or "procedure".

[H:\prog] do search *.cpp void AND mess
shows all lines in *.cpp files which contain both "void" and "mess".

[H:\prog] do search *.cpp void ANDNOT mess
shows all lines in *.cpp files which contain "void", but not "mess".

DO SEARCH does not search the following (binary) file types:
    EXE, DLL, DRV, OBJ, MET, COM, SYS, PDF, PSF, HLP, INF,
    OS2, DMP, LIB, ICO, INF, RES, GIF, JPG, BMP, PCX, TIF, SRF

DO SEARCH is case-INsensitive. That means, if you search "THIS" and
DO finds "this", the line will be shown.

DO SEARCH does not support more than two search strings as parameters.


************************
** manipulating files **
************************

DO LOWERCASE, UPPERCASE, CAPITAL changes the case of files:
file.txt, FILE.TXT, File.txt

DO TIME:HH.MM changes the file time, but leaves the file date unchanged

DO DATE:MM-DD-YY or DATE:DD.MM.YY changes the file date, but leaves the file 
time unchanged

Before manipulating files, it is useful to test your wildcard parameters
with DO LIST.

********************
** locate progams **
********************

DO WHICH PROGRAMNAME shows full filename of progs which will be executed

"Do which" searches the files *.exe, *.com, *.bat, *.cmd in all directories
of your PATH environment variable.

sample:
[C:\mydata] do which do
H:\SOFTWARE\SHARE\PATH\do.exe (85.4 kB; 5-29-2004)
h:\software\cdrecord\cdx\do.exe (73.0 kB; 5-8-2004)

DO WHICHFIRST shows only the first occurence, and only the filename:

[C:\mydata] do which do
H:\SOFTWARE\SHARE\PATH\do.exe

If no file has been found, DO returns errorlevel 1, otherwise 0.

**************************
** usage in batch files **
**************************

DO WAIT n      waits for n seconds
DO WAIT hh:mm  waits for daytime hh:mm
DO SOUND n plays interal speaker c-major sound, n can be odd or even
DO SET NAME reads environment variable NAME from stdin and writes temp.cmd
DO WAITFORDRIVE D: waits for availability of drive D: (floppy or CD-ROM)
DO BATCH *.in [*.out] [startstring] [endstring]  for creating batch files

DO WAIT 0.450
*************

waits for 450 milliseconds.

"DO WAIT" is useful for e.g. a batch file in the startup folder. The batchfile
has to wait e.g. 30 seconds before executing tasks which require that the
computer has finished the boot process. Floating point values are supported,
e.g.

DO WAIT 23:59
*************

waits until one minute before midnight.

DO WAITFORDRIVE F:
******************

waits for availability of drive F:. After inserting the disk, especially
CD-ROM drives need some seconds to get available. If a batch file aleady
proceeds its job, the job will fail because the drive is not ready (yet).
To abort waiting, press Ctrl-C

DO ISDRIVEREADY F:
******************

returns 0 if the drive is ready (that means no error) or 1 if the drive is not
ready. You have to use the ERRORLEVEL command in a batch file:

do isdriveready F:
if errorlevel 1 goto NOT_HERE
echo Drive F: is available
goto end
:NOT_HERE
echo Drive F: is not available at the moment
:end

DO SOUND 10
***********

plays a c-major sound by using the internal speaker. Odd numbers play c-e-g-c'
and even numbers play the reverse sound c'-g-e-c. The higher the number, the
slower the sound.
Please note: Windows 95, 98 and ME do not support the internal speaker.

DO SET
******

"DO SET" is required if you want to set an environment variable with a value
which has been processed to stdout by another commandline program.
E.g. the "ADD.CMD" batch file in the BatchBurn package (BatchBurn is a set of
batch files for use with CDRECORD commandline CD burn software) uses "do set":

cdrecord -msinfo dev=%CD_BUS% >cdinfo.txt
do set cd_info <cdinfo.txt
call temp
del temp.cmd

"cdrecord" sends an address string where the current CD-ROM data ends to stdout:
cdrecord -msinfo dev=%CD_BUS%
21098,30989

and this address is saved in the file "cdinfo.txt".

do set cd_info <cd.info.txt
simply writes a batch file temp.cmd with the contents:
@set cd_info=21098,30989

So "do set" simply adds some strings and creates a file "temp.cmd". That's all.


DO BATCH
********

"DO BATCH" is useful if you want to run a program (e.g. a file converter) for
a lot of files, and the program does not understand wildcards.

Principally, "DO BATCH" is similar to DO LIST:

[C:\] do list *.txt
mydoc1.txt
mydoc2.txt
subdir\otherdoc1.txt
subdir\otherdoc2.txt

"DO Batch" let you add additional strings before and behind the filename:

[C:\] do batch *.txt "startstring" "endstring"
startstring mydoc1.txt endstring
startstring mydoc2.txt endstring
startstring subdir\otherdoc1.txt endstring
startstring subdir\otherdoc2.txt endstring

Please use the " characters, otherwise spaces in "startstring" are not valid.

If you add a second wildcard, the filename gets repeated with the second
file extension:

[C:\] do batch *.wav "startstring" "endstring" *.mp3
startstring mymusic1.wav endstring mymusic1.mp3
startstring mymusic2.wav endstring mymusic2.mp3

Now all this is useless until you send the stdout to a batch file:

[C:\] do batch *.wav "gogo -b 128" *.mp3 >MakeMP3.cmd
[C:\] type MakeMP3.cmd
gogo -b 128 mymusic1.wav mymusic1.mp3
gogo -b 128 mymusic2.wav mymusic2.mp3


*** DELETING FILES ****


   W A R N I N G  !!! 
   This functionality can dramatically cause harm with little input!
   
DO DELETE *.txt

deletes all files ending with ".txt" in the current directory and its
subdiretories.

To be sure that the files are corretly specified, type the same command
with LIST instead:

DO LIST *.TXT

DO DELETE won't delete files in read-only mode, but this does
DO DELETEHARD

DO DELETEDIR also deletes empty directories and

DO DELETEHARDDIR deletes read-only files and empty directories.

To run deleting files in quiet mode, enter a Q:
DO DELETEQ
DO DELETEHARDQ
DO DELETEHARDDIRQ

In this case, every deleted file will be prompted with a single dot instead
of the full filename.







*** OPERATIONS FOR CD-ROM DRIVES (OS/2 only) ***

DO EJECT X:
DO OPENCLOSE X:
DO OPENCLOSE X: 15    opens, waits 15 sec, closes (default is 3 sec)
DO RESET X:

DO EJECT X: seems not to work with USB drives.


Send comments to info at Hypermake.de
