Do - Apply commands to list of files (Rainbow or IBM PC) Usage: do [-o1] "" Do reads a list of file names, one per line, from the standard input; for each file, the pattern string is evaluated and the result written to a batch file. The batch file is then executed. The following characters have special meaning in the pattern string: & Substitute the file name ^ Substitute the drive letter of the file name @ Substitute the directory portion of the file name (no trailing backslash) # Substitute the file extension portion of the file name % Substitute the file name minus the directory and extension \n Substitute a newline \ Removes special meaning from the following character (including another \) ` Substitute a backslash (shorthand for "\\"; useful in file names) DO is intended for use with the -f (for filter) option of LS, which lists matched files one per line on the standard output. As an example, consider ls -f *.c *.obj | do "copy & b:\ndel &" LS writes all files in the current directory of type .C and .OBJ, one per line, to its standard output. LS's standard output is piped into DO's standard input by MS-DOS; for each file DO then writes the two lines copy b: del to a temporary batch file. The & characters in the pattern string were changed to the file name; \n caused the line to be split. The batch file is automatically executed and deleted. The -o option causes the resulting commands to be written to the standard output rather than executed. The -1 option causes DO to process the pattern string once only, replacing the & character with ALL the files in the input list, separated by spaces. The pattern characters ^@#% should not be used with -1. As another example, consider ls -rf *.DAT | do "rename & @`#.SAV" The -r option of LS causes LS to descend the entire directory tree below the current directory, matching *.DAT in each directory. The file names written to the standard output include the directory specification for files not in the current directory. The @`# string is converted by DO into the file name minus the extension. The effect is to rename all .DAT files to .SAV files. Finally, ls -f *.c | do -1 "vi &" generates vi ... where the 's are all the .C files in the current directory. Copyright (c) 1985,86,87 by Bryan Higgins. The author may be reached/rewarded at 1802 Channing Way Berkeley, CA 94703 One of the Kramden Utilities.