home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / runfor19.zip / runfor.doc
Text File  |  1998-03-31  |  26KB  |  547 lines

  1. ============================================================================
  2. RUNFOR.DOC                              March 31, 1998
  3. ============================================================================
  4.  
  5. Ver 1.9
  6.  
  7. A utility that can run a command for a particular set of files or dirs.
  8. This program will work under (hopely) various command shells on OS/2, DOS,
  9. Windows 95, and (hopely) Windows NT systems.
  10.  
  11. This is a freeware if you don't modify the program.  Use this program at
  12. your own risk.    Please distribute this document together with executables.
  13.  
  14.  
  15. ----------------------------------------------------------------------------
  16. INTRODUCTION
  17. ----------------------------------------------------------------------------
  18.  
  19. I wrote this program to make jobs easier with more flexible selections of
  20. files/dirs and with more flexible handling arguments of a program to be run
  21. when I had to repeatedly enter the similar command for each file or dir for
  22. a large set of files, especially when a program does not accept wildcards.
  23.  
  24.  
  25. ----------------------------------------------------------------------------
  26. INSTALLATION
  27. ----------------------------------------------------------------------------
  28.  
  29. Files included in runfor*.zip are
  30.  
  31.     runfor.doc        - this documentation
  32.     os2\runfor.exe    - for OS/2 only     (requires emxrt.zip)
  33.     os2\runfors.exe    - stand-alone OS/2 executable (doesn't need emxrt.zip)
  34.     emx\runfor.exe    - for OS/2 and DOS/Win    (requires emxrt.zip or RSX)
  35.     win32\runfor.exe    - for Win32 (Win95/NT)    (requires RSXNT)
  36.  
  37. These programs were compiled by emx/gcc 0.9c, and require either EMX or
  38. RSX/RSXNT runtime package installed on your system.  Once you have installed
  39. a runtime package, copy an executable to a directory in PATH.
  40.  
  41. RunFor has been tested on OS/2, OS/2 DOS box, WinOS/2, MSDOS, Win95 systems,
  42. but on WinNT.
  43.  
  44.  
  45. Where can I get a runtime library package?
  46. ------------------------------------------
  47.  
  48. (1) EMX runtime package (emxrt.zip):
  49.  
  50.     ftp://hobbes.nmsu.edu/os2/unix/emx09c/emxrt.zip
  51.     ftp://ftp.cdrom.com/pub/os2/unix/emx09c/emxrt.zip
  52.     ftp://ftp.uni-stuttgart.de/pub/systems/os2/emx-0.9c/emxrt.zip
  53.  
  54.     Refer to its documentations to install it.
  55.  
  56. (2) RSX runtime package (rsx*.zip):
  57.  
  58.     ftp://ftp.uni-bielefeld.de/pub/systems/msdos/misc/rsx510b.zip
  59.     ftp://ftp.cdrom.com/pub/tex/ctan/systems/msdos/dpmigcc/rsx510b.zip
  60.     ftp://ftp.dante.de/tex-archive/systems/msdos/dpmigcc/rsx510b.zip
  61.  
  62.     emxrsx.zip has both EMX and RSX runtime packages:
  63.  
  64.     ftp://ftp.cdrom.com/pub/tex/ctan/systems/msdos/emtex/emxrsx.zip
  65.     ftp://ftp.dante.de/tex-archive/systems/msdos/emtex/emxrsx.zip
  66.  
  67. (3) RSXNT runtime package (rsxnt*r.zip):  (superset of RSX package)
  68.  
  69.     ftp://ftp.uni-bielefeld.de/pub/systems/ms-dos/misc/rsxnt14r.zip
  70.     ftp://ftp.cdrom.com/pub/tex/ctan/systems/msdos/dpmigcc/rsxnt14r.zip
  71.     ftp://ftp.dante.de/tex-archive/systems/msdos/dpmigcc/rsxnt14r.zip
  72.  
  73. [For OS/2 Users]
  74. ----------------
  75. As os2\runfors.exe has emx runtime code bound, it does not require emxrt.zip,
  76. but normally use os2\runfor.exe whenever emx runtime libs (.dll) are available
  77. on your system.  You may use emx\runfor.exe under OS/2.
  78.  
  79. Install emxrt.zip if required, and copy an executable to a directory in your
  80. PATH.  This completes the installation.
  81.  
  82. [For DOS/Win users]
  83. -------------------
  84. emx\runfor.exe can run under both platforms of OS/2 and plain DOS with emxrt
  85. installed, or under OS/2 DOS box or Windows DOS box with RSX runtime package.
  86. RSX is required if you run RunFor under a DPMI host (e.g. Windows 3.x DOS box,
  87. WinOS/2, QDPMI, 386MAX, etc.), otherwise emxrt is required.
  88.  
  89. After emxrt.zip and/or rsx501b.zip are installed (emxrsx.zip has both),
  90. copy emx\runfor.exe to a PATH.    And, if you are using EMX under DOS (VCPI)
  91. without any DPMI host, then add:
  92.  
  93.   set EMXOPT=-p
  94.  
  95. in your autoexec.bat to ensure enough free memory, and reboot.    That's it.
  96. (RSX doesn't need -p option, which is ignored by RSX.)
  97.  
  98. If RunFor could not start some DOS programs or crashes, you may not
  99. have enough free memory.  You need to enable UMB (Upper Memory Block)
  100. and allocate enough memory to your memory manager and load DOS in HMA
  101. (High Memory Area) in your CONFIG.SYS.    A sample CONFIG.SYS would be
  102.  
  103.     DEVICE=C:\WIN3\HIMEM.SYS
  104.     DEVICE=C:\WIN3\EMM386.EXE RAM frame=none HIGHSCAN x=a000-c7ff
  105.     DOS=HIGH,UMB
  106.  
  107. [For Win95/NT Users]
  108. --------------------
  109. win32\runfor.exe was compiled as a Win32 console application for Win95 or NT.
  110. You should install RSXNT 1.40 (or later) runtime package (rsxnt14r.zip).
  111. Copy win32\runfor.exe to a directory in PATH.  This finishes the installation.
  112.  
  113.  
  114. ----------------------------------------------------------------------------
  115. Setting Default Options by Environmental Variables
  116. ----------------------------------------------------------------------------
  117.  
  118. If you want to change the default settings of RunFor, you may set 'RUNFOROPT'
  119. env variable in your CONFIG.SYS or from a batch cmd file.  For example,
  120.  
  121.   set RUNFOROPT=-HS    (No hidden, no system attrib; same as RUNFOROPT=-H -S)
  122.  
  123. Any options can be set in 'RUNFOROPT' env, but I would not recommend you
  124. put options that can't be turned off from the command line.
  125.  
  126. If you keep a few copies of executables in different names, you can keep
  127. different default settings via their own envs.    Those env names are determined
  128. by uppercase program name (before the first '.') plus "OPT".
  129.  
  130. For example, if you copied a RunFor executable to 'spawn.exe', the program
  131. will first look for 'SPAWNOPT' env before searching 'RUNFOROPT'.  If 'SPAWNOPT'
  132. is found, 'RUNFOROPT' is not searched.  If you make another copy named
  133. 'doit.exe', you can set 'DOITOPT' env for doit.exe.  Of course, if those
  134. envs are not found, spawn.exe and doit.exe share 'RUNFOROPT' env setting.
  135.  
  136.  
  137. ----------------------------------------------------------------------------
  138. USAGE
  139. ----------------------------------------------------------------------------
  140.  
  141. This program is self-explanatory.  'runfor' and 'runfor -?'  will display
  142. short or long help screens.  (Even if you rename 'runfor.exe' to other name,
  143. its help screen will correclty display the new program name.)
  144.  
  145. Refer to the help screen.
  146.  
  147.  
  148. ----------------------------------------------------------------------------
  149. DISCLAIMER
  150. ----------------------------------------------------------------------------
  151.  
  152. RunFor was originally written for OS/2.  RunFor may behave differently or
  153. incorrectly under DOS/Win/Win95/NT than OS/2.  This program may have bugs as
  154. usual.    However, please don't blame me.  Use at your own risk.
  155.  
  156.  
  157. ----------------------------------------------------------------------------
  158. Known bugs and problems
  159. ----------------------------------------------------------------------------
  160.     - Incorrect file access time on Win95 (+/-Ta, %Ta)
  161.  
  162.  
  163. ----------------------------------------------------------------------------
  164. HISTORY
  165. ----------------------------------------------------------------------------
  166.     Ver 0.x
  167.     Ver 1.0    January 18, 1996
  168.     - first release to public
  169.  
  170.     Ver 1.1    January 19, 1996
  171.     - Added English month name in date argument of +T or -T.
  172.     - Very flexible ordering of date parameters.
  173.  
  174.     Ver 1.1a    January 19, 1996 (not released)
  175.     - Fixed: outfile could be incorrectly included in target file list.
  176.  
  177.     Ver 1.1b    March 19, 1996 (not released)
  178.     - Use PAGER for long help screen
  179.  
  180.     Ver 1.2    June 7, 1996
  181.     - New option: @<file>    target/exclude list in a file.
  182.     - New option: -t    not to look at disk for valid targets.
  183.     - New macros: %P and %R for path dir without ending '\' or '/'.
  184.     - New macro prefix modifiers:
  185.         %l    convert to lowercases
  186.         %u    convert to uppercases
  187.         %x    convert to unix style path ('/') (e.g. %xF)
  188.     - Changed: %l, %u, %x are global options when used before ':'.
  189.  
  190.     Ver 1.2a    September 17, 1996 (not released)
  191.     - Bug fix: broken PAGER support in DOS.
  192.     - Compiled with emx/gcc 0.9c (fixed some minor glitches)
  193.  
  194.     Ver 1.3    October 31, 1996
  195.     - Enhanced wildcard expansion support (more robust).
  196.     - Known bug(?): case-ignore in POSIX pattern matching with [...]
  197.             doesn't work due to emx/gcc 0.9c's fnmatch().
  198.     - @<file> now can include quoted names.
  199.  
  200.     Ver 1.4    February 28, 1997
  201.     - New feature to -w option:
  202.         Double option (-ww, -w -w) changes current working dir into
  203.         target dir, which is one level deeper than single option (-w).
  204.     - New macro prefix modifier:  %m for mixed-case conversion.
  205.     - New +T and -T options for HPFS drives:
  206.         +Tm  -Tm    modified time (default; same as +T, -T)
  207.         +Ta  -Ta    accessed time
  208.         +Tc  -Tc    created time
  209.     - +/-T options can now take seconds with hh:mm:ss (previously, hh:mm)
  210.     - Bug fixed: for +/-T options, incorrect selection by wrong timezone
  211.         computation and incorrect day of week on screen message.
  212.     - Removed a verbose message of changing dir ("Entering directory:").
  213.  
  214.     Ver 1.5    March 12, 1997
  215.     - New options:
  216.         +B -B ddd[k|kb|m|mb]    file selection by minimum/maximum sizes
  217.         -o-     '-' for standard output.
  218.         -e-     '-' to disable macro expansion in env setting.
  219.         -@ *    next argument is a target name (to escape switch symbol)
  220.         -x@ *   next argument is a exclude name (to escape switch symbol)
  221.     - New macro codes:
  222.         %T        file date and time (with various formats by prefixes)
  223.         %[m]B   file size
  224.         %ddd    positioning at column 'ddd' in expanded string.
  225.     - Changes and enhancements:
  226.         -m        don't expand macros (just renamed -n of previous version)
  227.         -x[@] * now supports disk and path in exclude name pattern.
  228.         %r macro now gives relative path even if target is in other drive.
  229.         +/-T now accepts two-digit year for the years of 1970-2069.
  230.     - Bug fixed:
  231.         Location of output file (-o) when -w was used.
  232.         Removed output file from target list.
  233.         Cleaned some minor glitches when no target or -t was given.
  234.  
  235.     Ver 1.6    April 28, 1997
  236.     - New option:
  237.         -C dir  change the default dir (of runfor) to "dir" before
  238.             running. (Useful in makefiles)
  239.  
  240.     Ver 1.7    September 18, 1997
  241.     - New features:
  242.         -r[-]    [-] to sort dirs first.
  243.         +/-T [+]*    [+] for relative date/time before today.
  244.  
  245.     Ver 1.8    November 6, 1997
  246.     - New option:
  247.         +/-E[*]    Extended attributes (OS/2)
  248.     - New macro codes:
  249.         %E        first or matching EA name (OS/2)
  250.         %E*     all EA names (OS/2)
  251.         %L        .LONGNAME value converted to a valid HPFS name (OS/2)
  252.     - Bug fixes of incorrect screen messages:
  253.         - current working dir (when targets are on other drive)
  254.         - job counter within target subdir for -ww option
  255.  
  256.     Ver 1.8a    January 5, 1998     (not released)
  257.     - Changed %(ENV) macro:
  258.         - removed -e- option (disable env macro expansion),
  259.         - ENV value can have any macro codes to be expanded,
  260.         - %(ENV)! is not to expand macros embedded in ENV value,
  261.         - Embedded env macros are expanded up to 10 in recursive depth.
  262.     - fixed: SHELL & COMSPEC var were ignored.
  263.     - add -c (instead of /c) for shells other than cmd.exe or command.com.
  264.     - new feature:    -e SHELL=shell spawns child process with given shell.
  265.  
  266.     Ver 1.9    March 31, 1998
  267.     - Added Win32 (Win95/NT) support by RSXNT (tested on Win95 but not NT)
  268.     - New macro codes for time info of files:
  269.         %Tm (modified, same as %T), %Ta (accessed), %Tc (created).
  270.     - fixed: %T is now empty string for null target
  271.  
  272.  
  273. ----------------------------------------------------------------------------
  274. Help Screen (Actual output from 'runfor -?')
  275. ----------------------------------------------------------------------------
  276.  
  277. runfor  Ver 1.9 - Run a command - Mar 31 1998,  W. Kim
  278.  
  279. Syntax: runfor [options] [targets] [-x exclude_names] : [@]command [args]
  280.  
  281. Options: (can go anywhere before ':')
  282.   -?     Help screen (long) (Add suffix '-' to override PAGER: -?-, -h-)
  283.   -a     Targets are both directories and files
  284.   -c     Confirm before each command execution
  285.   -C *   Change the default dir as if runfor was started from there
  286.          ("runfor -C foo : prog" is equivalent to "cd foo & prog & cd ..")
  287.   -d     Targets are directories (default targets are files only)
  288.   -h     (same as -?)
  289.   -i     Ignore letter cases in POSIX pattern matching (not work without -p)
  290.   -m     Do not expand macro codes in command + arguments
  291.   -o {*|-}  Output expanded cmd args to a file or stdout(-) without executions
  292.   -p     POSIX pattern matching (affects -x as well); Add -i to ignore case
  293.   -q[q]  Quiet [quieter] mode  (place -qq before +T or -T to turn off time log)
  294.   -Q[#]  Quit if a command returns an exit code >= #   (-Q = -Q1)
  295.   -r[-]  Recursive run for all subdirs; Add '-' to sort dirs first before files
  296.   -t     Don't look at disk to get target names (i.e. use given names as-is.)
  297.          -t must be given before any target/exclude names.
  298.   -u     Unix style path name ('/' for directory separators); convert all args.
  299.   -w[w]  Change working dir of command to subdir of target [into target dir]
  300.  
  301.   +R -R  Only files/dirs with(+) or without(-) READ-ONLY attribute
  302.   +H -H  Only files/dirs with(+) or without(-) HIDDEN attribute
  303.   +S -S  Only files/dirs with(+) or without(-) SYSTEM attribute
  304.   +A -A  Only files/dirs with(+) or without(-) ARCHIVE attribute
  305.   +E* -E*  Only files/dirs with(+) or without(-) Extended Attributes (OS/2)
  306.            A specific EA name (case-insensitive) may be given with wildcards
  307.            of ?, *, or [].   E.g.: +E, +E.longname, +E.*, -E*icon*, +Eepm??*,
  308.            +E.[!LI]* (EAs starting with a '.' but not followed by 'L' or 'I')
  309.  
  310.   +B -B ddd[K|KB|M|MB]     Files bigger(+B)/smaller(-B) than 'ddd' bytes/KB/MB
  311.  
  312.   +T[?][+][date][;][[hh]:[mm]:[ss]] Files/dirs ON or AFTER the given date/time
  313.   -T[?][+][date][;][[hh]:[mm]:[ss]] Files/dirs ON or BEFORE the given date/time
  314.        [?] can be m (modified; default), a (accessed), or c (created).
  315.            (On FAT drives, modified time == accessed time == created time.)
  316.        [+] is to give a relative time period before today (like 30 days ago).
  317.            English month names are not allowed with '+'.
  318.        date = [yy]yy-{mm|mmm}-dd in almost any order. (mm=1-12, mmm=Jan-Dec)
  319.        Among 3 parts of date, ';', and time, at least one must be given.
  320.  
  321.        Valid date strings with numeric month (mm doesn't go after dd) are:
  322.  
  323.          [yy]yy-mm-dd, mm-dd, dd, [yy]yy, mm-dd-[yy]yy, [yy]yy-mm, mm-[yy]yy
  324.  
  325.        With English month names (mm <= mmm in above), the additional forms are:
  326.  
  327.          dd-mmm-[yy]yy, dd-mmm, mmm  (very flexible ordering!)
  328.  
  329.        Any missing date parameters (yy, mm, dd) are copied from today,
  330.        and if a time parameter (hh,mm,ss) is missing, it assumes to be zero.
  331.        (e.g. If this year is 1996, +/-T95 means after/before a year ago.)
  332.  
  333.        Year yyyy should be in the range of 1970-2106.  However, for small yy,
  334.            if yy >= 70, yy means the year of 1900+yy;
  335.            if yy <  70, yy means the year of 2000+yy.
  336.  
  337.   %l %u %x  Convert all arguments and macros to lower/upper/unix-style path
  338.        Use macro prefix modifiers to selectively modify macro expansions.
  339.  
  340.   targets  Target file or dir names (wildcards can be used in target string.)
  341.            (Note: Any target not found on disk is excluded by default. See -t.)
  342.            @<file> can be used together to get targets from <file> in which
  343.            no line can have more than one name. (i.e. one name per line.)
  344.  
  345.   @file    Read "file" for target names or exclude names (if given after -x).
  346.  
  347.   -@ *     Next argument is a target name (to escape '-','@','%' switches)
  348.            (e.g. -@ @abc -@ -foo   where "@abc", "-foo" are target names)
  349.  
  350.   -e *     Set env vars before running;  Use double quotes to include a space.
  351.            Env settings are passed to executables, but not to batch commands.
  352.  
  353.   -x[@] *  Exclude names from target dirs or files. (e.g. -x *.zip d:*\abc\*)
  354.            -x accepts multiple arguments including @file form as in targets.
  355.            Use -x@ to escape switch symbol for the next argument: -x@ @foo @bar
  356.            where "@foo" itself and the names from file "bar" will be excluded.
  357.  
  358.    :       Command (and its arguments) to be run goes after this separator
  359.  
  360.    @       Direct execute without spawning a command shell.  '@' makes faster
  361.            execution, but does not work for .cmd/.bat or I/O redirections.
  362.  
  363. Macro Codes for command + arguments:
  364.  
  365.    %%    % itself
  366.    %d    Drive                            (e.g. "H:")
  367.    %p    Subdir path                      (e.g. "\src\C\utils\")
  368.    %P    Subdir path without ending '\'   (e.g. "\src\C\utils")
  369.    %n    File/dir name without extension  (e.g. "runfor")
  370.    %e    File/dir extension               (e.g. ".doc")
  371.    %f    File/dir name with extension     (e.g. "runfor.doc")
  372.    %F    Full path name of a file/dir     (e.g. "H:\src\C\utils\runfor.doc")
  373.    %r    Relative dir from working dir    (e.g. "utils\")
  374.    %R    Relative dir without ending '\'  (e.g. "utils")
  375.    %Tm %Ta %Tc  File date & time of last modification (= %T), access, creation
  376.          Time formats by prefix modifiers for %T = 1998-Jan-09 Fri 06:58:22,
  377.                %mT = 1998-Jan-09,     %xT = 1998-Jan-09 06:58:22
  378.    %B    File size in bytes (%m prefix converts to K (=1024) or M if too big)
  379.    %E    First EA name (that matches if a name pattern was given in +E) (OS/2)
  380.    %E*   All EA names (space delimited) (OS/2)
  381.    %L    Value of .LONGNAME EA, converted to a valid HPFS path name (OS/2)
  382.    %w#   (#+1)th wildcard expansion; # = 0-9, %w = %w0 (%w0="for." for run*doc)
  383.    %(ENV_NAME)  Env variable; name is case-sensitive; usually in uppercase.
  384.                 Macro codes embedded in env values are recursively expanded.
  385.                 Recursive expansions can happen only for %(ENV_NAME) macros.
  386.                 (limited up to maximum 10 recursions, e.g. AB=%(AB)X is 10 X's)
  387.    %(ENV_NAME)! Env value without expanding embedded macros.
  388.    %#[#...]     Target counter; %## will be replaced by 2+ digits: 01, 02, ...
  389.    %ddd[ ]      Position at column 'ddd' or add 'ddd' spaces if space followed
  390.              ('%20X' puts X at column 20 while '%20 X' adds 20 spaces before X)
  391.  
  392. Macro prefix modifiers: (override global %l, %u, %x options)
  393.    (Syntax: %[modifiers][%]macro_code,  e.g. %uxF or %u%x%F)
  394.    %l    Convert to lowercases            (e.g. %l(PATH))
  395.    %m    Convert to mixedcases            (e.g. %mf = "Runfor.doc")
  396.    %u    Convert to uppercases            (e.g. %uf = "RUNFOR.DOC")
  397.    %x    Unix-style path ('/')            (e.g. %lxP = %xlP = "/src/c/utils")
  398.  
  399.    Note: These modifiers may have different meaning for %T* or %B macro codes.
  400.  
  401. Wildcards in POSIX Pattern Matching:
  402.  
  403.    ?       matches any single character.
  404.    *       matches zero or more occurances of anything.
  405.    [abc]   matches any character of 'a', 'b', or 'c'.
  406.    [!abc]  matches any character except 'a', 'b', and 'c'.
  407.    [a-z]   matches any character from 'a' to 'z'.
  408.  
  409. Description:
  410.  
  411.    It executes a command using a command shell given by COMSPEC or SHELL env,
  412.    or directly executes the command if '@' is in front of the command.  If a
  413.    target name was given with wildcards, it executes a command (that may not
  414.    accept wildcards) for every matching target file or dir, and its arguments
  415.    can have macro codes of substitution for drive, dir, name, extension, etc.
  416.    taken from the matching target file/dir. It can recursively run for subdirs.
  417.  
  418. Environmental Variables:
  419.  
  420.    RUNFOROPT   Set this env var to change the default behavior of this program
  421.                in either OS/2 config.sys (DOS autoexec.bat) or a batch file.
  422.                If the last option in "RUNFOROPT" setting is either -e or -x,
  423.                then "RUNFOROPT" setting must end with a '-'.  For example,
  424.  
  425.                set RUNFOROPT=-q -H -S -x *.Z -     (note '-' at end)
  426.                (A shorter setting would be "set RUNFOROPT=-x *.Z -qHS")
  427.  
  428.    xxxOPT      where "xxx" is the executable name before '.' in uppercases.
  429.                For example, if you copied this program to "spawn.exe", spawn
  430.                first searches SPAWNOPT env for its default settings, and
  431.                then RUNFOROPT is searched only if SPAWNOPT was not found.
  432.  
  433.    PAGER       Optionally set this env to use a pager (like less or list) for
  434.                this long help screen.  If PAGER is not found, stdout is used.
  435.  
  436. Using Double Quotes: (I/O redirections and blank spaces in names)
  437.  
  438.    For I/O redirections, '@' (direct execution) should NOT be used in front of
  439.    an executable command so as to invoke a command shell that can redirect I/O.
  440.    To pass redirection symbols (like '>') to the child process (command shell),
  441.    enclose them (or the whole command string) with matching double quotes.
  442.    Double quotes are stripped off before passing to child process.
  443.    To pass a double quote explicitly, use a backslash('\') before double quote.
  444.    If target names have blank spaces, enclose them with explicit double quotes.
  445.  
  446. Examples:
  447.  
  448.    - To take `diff' between all same named files of *.c and *.doc in e:
  449.      and current dir:
  450.  
  451.        runfor *.c *.doc : @diff e:%f %f
  452.  
  453.    - To create a batch file "batch.cmd" for later execution:
  454.  
  455.        runfor -q -o batch.cmd *.c *.doc : @diff e:%f %f
  456.  
  457.    - Find all files >= 1MB from subdirs, which were last modified on or after
  458.      97-Mar-01, and save those file names (relative path names) to a file:
  459.  
  460.        runfor -o files.lst * +B 1mb +Tmar-01-97 -rq : @%r%f
  461.  
  462.    - To list files (date/time, size, name) under subdirs to standard output:
  463.  
  464.        runfor -qro- * : @%Tm %mB %r%f
  465.  
  466.    - To run a command after converting its arguments to unix-style path:
  467.  
  468.        runfor -u : prog args   (TeX is a good example.)
  469.  
  470.    - Wildcard macro expansion:  To rename "abc*-??.dat" files to "xyz??-*.dat"
  471.      with confirmation:
  472.  
  473.        runfor -c abc*-??.plt : ren %f xyz%w1%w2-%w0.dat
  474.  
  475.    - POSIX pattern matching:   runfor [A-Ka-k]* -x *.z -piqq : echo %f
  476.  
  477.    - For files with some attributes:   runfor * +HS -A : attrib \"%f\"
  478.      (Double quotes protect spaces in expanded names for "attrib" command.)
  479.  
  480.    - Some examples of arguments for +/-T: (+ or - before T is not shown here)
  481.        T;  T-  T:  T0  T-;:  T0;0   T+     == 00:00:00 of today.
  482.        T8-12      TAug-12   T12-August     == Aug-12 00:00:00 of this year.
  483.        T95-8-12   T8-12-95  T12-Aug-95     == 1995-Aug-12 00:00:00.
  484.        T2001-8-12 T01-12-Aug  T101-12-Aug  == 2001-Aug-12 00:00:00.
  485.        T8-  T-8-  TAug         == 00:00:00 of today in August of this year.
  486.        T12  T12;  T-12  T--12  == 00:00:00 of the 12th day of this month.
  487.        T15: T;15  T15:00       == 15:00:00 of today.
  488.        T95  T1995 T95-  T-95   == today 00:00:00 of 1995.
  489.        T+;5    == 5 hours ago,     T+60    == 00:00:00 of 60 days ago
  490.        T+60;   == the same time (as now) of 60 days ago
  491.        T+2-15  == 00:00:00 of 2 months and 15 days ago
  492.        T+3--   == 00:00:00 (of the same month and day) of 3 years ago
  493.  
  494.        "-TAug-12-96 +Ta97-1-1" selects files modified on or before
  495.            1996-Aug-12 00:00:00 but accessed on or after 1997-Jan-01 00:00:00
  496.  
  497.    - Selecting files/dirs of attributes is based on `AND' operator. That is,
  498.      "+HS -RA" means `Hidden=1 AND System=1 AND ReadOnly=0 AND Archive=0'.
  499.  
  500.      "-HS" (= -H -S) means files/dirs of not hidden nor system attributes.
  501.  
  502.    - Target counter %# (Try these in a dir having more than 10 files):
  503.        runfor -qq * : echo %#: %f
  504.        runfor -qq * : echo %##: %f
  505.        runfor -qq * : echo %###: %f
  506.  
  507.    - Env settings: (Usually env names are in uppercase.)
  508.        runfor -q -e abc=Hello. ABC="There is." : echo %(ABC) %(abc)
  509.        runfor -q -e ABC="prog.exe can see this env setting." : prog.exe args
  510.  
  511.    - Environment variable may contain macro codes to be expanded:
  512.        runfor -q * -e ABC="File name is %f." : echo %(ABC)
  513.        (To avoid macro expansion for envs, add '!' like %(ABC)!.)
  514.  
  515.    - Reading target or exclude list from a file: (@<file>)
  516.        runfor -tq @file1 -x @file2 : cmd ...   
  517.        (file1 has target names, and file2 has names to be excluded.)
  518.        (-t is given so that targets in file1 are not searched on disk.)
  519.        If '@' is part of file/dir name, use -@ or -x@. (-@ @file1 -x@ @file2)
  520.  
  521.    - To run "prog" for every file that matches with "blank in file name*"
  522.      and save the screen outputs (redirection) to a log file "result.log":
  523.  
  524.        runfor "blank in file name*" : "prog \"%f\" >> result.log"
  525.  
  526.      where \"%f\" is used because the expanded file name(s) have blank
  527.      spaces (thus explicit double quotes should be used).
  528.  
  529.    - Recursive run into subdirs and changing working dirs:  The following
  530.      examples will show the difference between -w and -ww (-w -w).
  531.        runfor -rqqdww * : cd           -- target dirs
  532.        runfor -rqqdw * : cd            -- parent dirs of targets
  533.        runfor -rqqdw * : (cd %f & cd)
  534.  
  535. Return Codes: (for single input)
  536.    0 - Successful Completion
  537.    1 - Invalid Command Switch or Argument
  538.    2 - Unable to OPEN
  539.    3 - Unable to READ
  540.    4 - Unable to WRITE
  541.    5 - Invalid Data/Format
  542.    6 - Invalid Name
  543.    7 - Error During Execution
  544.    8 - Help screen due to an error
  545.  
  546. -- Wonkoo Kim (wkim+@pitt.edu)
  547.