FINDALL.DOC by James Main Kenney 1996 Documentation for FINDALL.BAS and FINDALL.EXE, programs to search for multiple strings in multiple files. FINDALL.BAS will run under either GW-BASIC, supplied with MS-DOS 3 and 4, or QBASIC, supplied with MS-DOS 5 and 6. FINDALL.EXE will run directly under MS-DOS/Windows; it is a compiled version of FINDALL.BAS which runs faster and does not require a BASIC interpreter. The compiler was PowerBASIC 2.10g. A Windows icon, FINDALL.ICO, has been created for use with FINDALL.EXE. FINDALL displays and optionally saves to a file the name of each file containing one or more of the entered strings. Each filename is followed by the strings contained in that file. Only one occurance of a particular string in a file is noted: when a match is found, FINDALL then looks for the next string. Up to 80 strings may be searched for, with a maximum total of 240 characters (including double spaces added between strings by the program). FINDALL can search files in any directory on any drive. The name of a file to be searched can be directly entered, or the name of a file listing the names of files to be automatically searched can be entered; this file list need not have a special format, but for a filename to be recognized as such it must have a period (even if it has no extension) and its ends must be delimited by characters not used in filenames, such as spaces, parentheses, quotes, slashes, or punctuation marks (even extra periods). (These delimiters may be changed by editing line 4 of FINDALL.BAS. FINDALL.EXE cannot be directly altered: a new version must be produced by recompiling FINDALL.BAS after editing.) An attempt is made to open a file for each "reasonable" name (one to eight acceptable characters before a period and up to three after it) that appears on the list, and error trapping is used to recover if the file does not exist in the directory specified by the file path. A special feature is the optional trial of alternative extensions when the filename with the original extension was not found or, as another option, even if it was; this allows files to be found whose extensions may have been changed from those in the list, or forgotten by the user, or merely for faster and easier entry. The list of extensions is easily modified by editing the DATA statement on line 11 in FINDALL.BAS. Once use of the alternative extensions has begun, they are all automatically tried, regardless of success, so that the sequence of extensions will not prevent a second valid alternative extension being tried. If a data line exactly duplicates a line already in the data file, then the new line is not appended. Repeating the search at a later date for the same strings, entered in the same sequence, will therefore add data lines only for new or altered files (below a new header, with date and time, etc., where they are easily found). The Boolean conjunction ("and") can be implemented by using the data file produced by searching for one string as the filename file when searching for a second string: only the names of files containing both strings will appear in the second (new) data file. Simple Boolean searches can be done more easily, however, by a simultaneous search for all strings followed by a visual comparison of the strings found in each file. Using FINDALL.BAS, the file with the names of files to be searched cannot be the same file to which data is appended; using FINDALL.EXE, however, the same file may be used for both purposes. Operating Instructions: ---------------------- At the first prompt, enter the strings to be searched for (press ENTER after typing each string, e.g., a word or several words to be searched for as a group). After each entry the prompt will reappear, allowing the next string to be entered, unless a null entry is made by pressing only ENTER, which will terminate string entry. At each recurrance of the string prompt, a list of the strings entered to that point is presented, and a notice is given of the maximum number of characters permitted for that string (240 initially). This number may be shared by subsequent strings, but each string requires a two-byte overhead for two spaces inserted between strings by the program. A minimum of three bytes per string is therefore used, limiting the number of strings to eighty (hence the array dimensioning). (Added to the maximum filename length of 12 characters and the last double space, this 240 byte total length meets the 254 character limit for the LINE INPUT statement used in checking for duplicate lines.) At the second prompt, enter the name of a file to which the data will be appended, or press only ENTER if a permanent record is not desired. At the third prompt (which follows a display of the files in the current directory), enter the name of a file listing the names of files to be automatically searched, or press only ENTER if the filenames are to be directly entered at a later prompt. At the fourth prompt, enter the path for the files to be searched, or press only ENTER if they are in the same directory as FINDALL.EXE (or GW-BASIC or QBASIC running FINDALL.BAS). The final backslash is optional: FINDALL will append one if the path is entered without it. Finally, press a single key (upper or lower case) to select one of the following extensions options: * Press key N ("Never") to try to open the files using the filenames with their original extensions as they appear in the list file or are directly typed. * Press key A ("Always") to try to open the files using all of the alternative extensions regardless of whether or not trying to open with the original extension was successful. * Press key O, ("Only") or ENTER, or any other key except N or A, to use the alternative extensions only if an attempt to open with the original extension was unsuccessful. A caption header is then displayed above where the filenames and strings will appear, and is also printed to the data file (below date, time, list filename, file path, and strings searched for) if one was named at the second prompt. If no list file was named at the third prompt, the direct-entry prompt "File to search?" will now appear; enter a filename or press only ENTER to exit FINDALL. If a filename is entered, this prompt will reappear after the file is searched, facilitating rapid entry of the next filename. If a list file was named at the third prompt, the automatic searching of files whose names are extracted from the list will now start, the results of which are displayed ("pause" to examine in detail). For either the direct or automatic entry of filenames, the message "(file not in path)" will appear on the screen in place of data for names not corresponding to existing files in the selected path. The message "(duplicate line)" below a line of data indicates that this data was not appended to the data file because an exact duplicate is already in the data file for that exact filename. After the search for potential filenames in the list file is complete, information about the run is presented so that it is not necessary to exit FINDALL to examine the data file prior to a rerun. Press a single key (upper or lower case) to select one of the following terminal options: * Press key L ("List") to rerun, prompted to change only the file listing the names of the files to be searched, but leaving their path unchanged. * Press key P ("Path") to rerun, prompted to change only the path for the files to be searched, but using the same list file. * Press key B ("Both") to rerun, prompted to change both the list file and the file path. * Press key E ("Exit") or ENTER, or any other key except L, P, or B, to exit FINDALL. Pressing key P also allows the extensions option to be easily changed if no entry was previously made at the path prompt: after pressing key P, press only ENTER to reach the extensions option prompt.