Subj : Merging files... To : Laurent Jumet From : Andrea Mariani Date : Wed Nov 28 2001 04:23 pm Ciao Laurent! 27 Nov 01 16:44, Laurent wrote to All regarding Merging files...: LJ> COPY /B *.txt bigfile.txt LJ> This command doesn't sort the files; they are merged according to their LJ> order on the HardDisk, and 04 comes first, next is 10, next 01, and so on. LJ> I didn't find a convenient way to make that merging operation; how would LJ> you do yourself? I'd use the SELECT command. In your case: select /On copy [*.txt] bigfile.txt It's a powerful command, here's a copy of the help screen: 4DOS Help Topic: SELECT Purpose: Interactively select files for a command. Format: SELECT [/A[[:][-]rhsda] /C[HP] /D /E /H /I"text" /J /L /O[[:][-]acdeginrsu] /T:acw /X /Z] [command] ... (files...)... command: The command to execute with the selected files. files: The files from which to select. File names may be enclosed in either parentheses or square brackets. The difference is explained in the usage text. /A: (Attribute select) /J(ustify names) /C[HP] (Compression) /L(ower case) /D(isable color) /O(rder) /E (use upper case) /T(ime) /H(ide dots) /X (display short names) /I (match descriptions) /Z (use FAT format) File Selection Supports extended wildcards, ranges, multiple file names, and include lists. Date, time, or size ranges must appear immediately after the SELECT keyword. Use extended wildcards with caution on LFN volumes; see LFN File Searches for details. Usage SELECT allows you to select files for internal and external commands by using a full-screen "point and shoot" display. You can have SELECT execute a command once for each file you select, or have it create a list of files for a command to work with. The command can be an internal command, an alias, an external command, or a batch file. If you use parentheses around the files, SELECT executes the command once for each file you have selected. During each execution, one of the selected files is passed to the command as an argument. If you use square brackets around files, the SELECTed files are combined into a single list, separated by spaces. The command is then executed once with the entire list presented part of its command-line arguments. Using the SELECT File List When you execute the SELECT command, the file list is displayed in a full-screen format which includes a top-line status bar and shows the command to be executed, the number of files marked, and the number of Kbytes in those files. SELECT uses the cursor up, cursor down, PgUp, and PgDn keys to scroll through the file list. You can also use character matching to find specific files, just as you can in any popup window. While the file list is displayed you can enter any of the following keys to select or unselect files, display files, execute the command, or exit: + or space: Select a file, or unselect a marked file. -: Unselect a marked file. *: Reverse all of the current marks (except those on subdirectories). If no files have been marked you can use * to mark all of the files. /: Unselect all files. Ctrl-L: View the current highlighted file with LIST. When you exit from LIST, the SELECT screen will be restored. Enter: Execute the command with the marked files, or with the currently highlighted file if no files have been marked. Esc: Skip the files in the current display and go on to the next file specification inside the parentheses or brackets (if any). Ctrl-C or Ctrl-Break: Cancel the current SELECT command entirely. On FAT drives the file list is shown in standard FAT directory format, with names at the left an descriptions at the right. On LFN drives the format is similar but more space is allowed for the name, and the description is not shown. In this format long names are truncated if they do not fit in the allowable space. For a short-name format (including descriptions) on long filename drives, use the /X and / or /Z switches. When displaying descriptions in the short filename format, SELECT adds a right arrow [] at the end of the line if the description is too long to fit on the screen. This symbol will alert you to the existence of additional description text. You can use the left and right arrow keys to scroll the description area of the screen horizontally and view the additional text. You can display the filenames in color by using the SET command to create an environment variable called COLORDIR, or using the Commands page of the OPTION dialogs or a text editor to set the ColorDir directive in your .INI file. If you do not use the COLORDIR variable or the ColorDir directive, SELECT will use the default screen colors for all files. See the discussion of color-coded directories under DIR for more details. To disable directory color coding within SELECT, use the /D option. You can set the default colors used by SELECT on the Commands page of the OPTION dialogs or with the SelectColors and SelectStatBarColors directives in the .INI file. If SelectColors is not used, the SELECT display will use the current default colors. If SelectStatBarColors is not used, the status bar will use the reverse of the SELECT colors. Creating SELECT Commands In the simplest form of SELECT, you merely specify the command and then the list of files from which you will make your selection(s). For example: c:\> select copy (*.com *.exe) a:\ will let you select from among the .COM files on the current drive, and will then invoke the COPY command to copy each file you select to drive A:. After the .COM files are done, the operations will be repeated for the .EXE files. If you want to select from a list of all the .COM and .EXE files mixed together, create an include list inside the parentheses by inserting a semicolon: c:\> select copy (*.com;*.exe) a:\ Finally, if you want the SELECT command to send a single list of files to COPY, instead of invoking COPY once for each file you select, put the file names in square brackets instead of parentheses: c:\> select copy [*.com;*.exe] a:\ If you use brackets, you have to be sure that the resulting command (the word COPY, the list of files, and the destination drive in this example) does not exceed the command line length limit: 255 characters for internal commands or 126 characters for external commands. The current line length is displayed by SELECT while you are marking files to help you to conform to these limits. The parentheses or brackets enclosing the file name(s) can appear anywhere within the command; SELECT assumes that the first set of parentheses or brackets it finds is the one containing the list of files from which you wish to make your selection. When you use SELECT on an LFN drive, you must quote any file names inside the parentheses which contain whitespace or special characters. See File Names for additional details. For example, to copy selected files from the "Program Files" directory to the E:\SAVE directory: c:\> select copy ("Program Files\*.*") e:\save\ File names passed to the command will be quoted automatically if they contain whitespace or special characters. The list of files from which you wish to select can be further refined by using date, time, size, and file exclusion ranges. The range(s) must be placed immediately after the word SELECT. If the command is an internal command that supports ranges, an independent range can also be used in the command itself. You cannot use command grouping to make SELECT execute several commands, because SELECT will assume that the parentheses are marking the list of files from which to select, and will display an error message or give incorrect results if you try to use parentheses for command grouping instead. (You can use a SELECT command inside command grouping parentheses, you just can't use command grouping to specify a group of commands for SELECT to execute.) Advanced Topics If you don't specify a command, the selected filename(s) will become the command. For example, this command defines an alias called UTILS that selects from the executable files in the directory C:\UTIL, and then executes them in the order marked: c:\> alias utils select (c:\util\*.com;*.exe;*.btm;*.bat) If you want to use filename completion to enter the filenames inside the parentheses, type a space after the opening parenthesis. Otherwise, the command-line editor will treat the open parenthesis as the first character of the filename. When displaying descriptions, SELECT adds a right arrow [] at the end of the line if the description is too long to fit on the screen. This symbol will alert you to the existence of additional description text. You can use the left and right arrow keys to scroll the screen horizontally and view the additional text. With the /I option, you can select files based on their descriptions. SELECT will display files if their description matches the text after the /I switch. The search is not case sensitive. You can use wildcards and extended wildcards as part of the text. When sorting file names and extensions for the SELECT display, 4DOS normally assumes that sequences of digits should be sorted numerically (for example, the file DRAW2 would come before DRAW03 because 2 is numerically smaller than 03), rather than strictly alphabetically (where DRAW2 would come second because "2" comes after "0"). You can defeat this behavior and force a strict alphabetic sort with the /O:a option. SELECT normally writes text directly to the screen. If you have an unusual display adapter which does not support direct video output, see the OutputBIOS directive. If you receive a stack overflow error when using SELECT in complex, nested command sequences, see the notes under the StackSize directive. Options /A: (Attribute select) Display only those files that have the specified attribute(s) set. The colon [:] after /A is optional. Preceding the attribute character with a hyphen [-] will select files that do not have that attribute set. The attributes are: R Read-only D Subdirectory H Hidden A Archive S System If no attributes are listed at all (e.g., SELECT /A ...), SELECT will display all files and subdirectories including hidden and system files. If attributes are combined, all the specified attributes must match for a file to be included in the listing. For example, /A:RHS will display only those files with all three attributes set. /C: (Compression) Display compression ratios on compressed drives. The compression ratio is displayed instead of the file description. The ratio is left blank for directories, for files with a length of 0 bytes, and for files on non-compressed drives. The compression ratios will not be visible on LFN drives unless you use /Z to switch to the traditional short filename format. Only the compression programs distributed with MS-DOS and Windows 95 (DRVSPACE and DBLSPACE) are supported. Using /CH displays compression ratios like /C, but bases the calculation on the host drive's cluster size. This gives a more accurate picture of the space saved through compression than is given by /C. If /CP is used instead of /C, the compression is displayed as a percentage instead of a ratio. If /CHP is used instead of /CH, the host compression is displayed as a percentage. The /CHP option must be entered as shown; you can not use /CPH. See the DIR /C documentation for more details on how compression ratios are calculated. /D: (Disable color coding) Temporarily turn off directory color coding within SELECT. /E: (Use upper case) Display filenames in the upper case; also see SETDOS /U and the UpperCase directive in 4DOS.INI. /H: (Hide dots) Suppress the display of the "." and ".." directories. /I: (Match descriptions) Display filenames by matching text in their descriptions. The text can include wildcards and extended wildcards. The search text must be enclosed in quotation marks. You can select all filenames that have a description with /I"[?]*", or all filenames that do not have a description with /I"[]". /I will be ignored if /C or /O:c is also used. /J: (Justify names) Justify (align) filename extensions and display them in the traditional format. /L: (Lower case) Display file and directory names in lower case; also see SETDOS /U and the UpperCase directive in 4DOS.INI. /O: (Order) Set the sort order for the files. The order can be any combination of the following options: - Reverse the sort order for the next option. a Sort names and extensions in standard ASCII order, rather than sorting numerically when digits are included in the name or extension. c Sort by compression ratio (the least compressed file in the list will be displayed first). If /O:c is used with /CH or /CHP, the sort will be based on the host-drive compression ratios. For information on supported compression systems, see /C above. d Sort by date and time (oldest first). e Sort by extension. g Group subdirectories first, then files. i Sort by the file description (ignored if /C or /O:c is also used). n Sort by filename (this is the default). r Reverse the sort order for all options. s Sort by size. u Unsorted. /T:acw: (Time display) Specify which of the date and time fields on an LFN drive should be displayed and used for sorting: a last access date and time (access time is not saved on LFN volumes). c creation date and time. w last write date and time (this is the default). /X: (Display short names): Display short filenames, in the traditional FAT format (like /Z), on LFN drives /Z: (Use FAT format) Display filenames on an LFN drive in the traditional FAT format, with the short filename at the left and the description at the right. .... Best wishes, Andrea --- GoldED+/386 1.1.5-1022 * Origin: Murphy's BBS in collegamento con Moncalieri (2:334/403.17) .