Sort Directory Utility (SRD) Version 6.0 Shell Oil Company 22-Apr-80 Page 2 SRD -- Sort Directory Utility (Version 6.0) SRD is a RSX-11 utility that sorts a user file directory (UFD), then outputs it to a file or to the user's terminal. SRD can also select files by date and by parts of the file specification. The format of the command line is: >SRD [outfile [/switches] = ] [infile][/switches] Note that all fields are optional. The "outfile" and the "infile" are any file specifications in standard RSX format. The defaults that apply are as follows: outfile infile device: SY0: SY0: UIC: (current) (current) filename: DIRECTORY * filetype: .LST .* except that, if no output specification is given, the default output device is "TI:". Wild cards can be used in the input UIC specification. For example, the command >SRD LP:=[100,*] lists (on the line printer) all user file directories that belong to group 100. During a wild-card UIC scan, a directory with no files in it is not listed. The "filename", "filetype", and "version" fields of the "infile" specification can be used to select specific sets of files. The wild card ("*") can be used in any of these fields. For example, >SRD *.OBJ lists all files in the current UIC that have a filetype of ".OBJ". Files can also be selected by using wild characters in the filename and filetype fields of the "infile" specification. The wild characters that can be used are: Page 3 character meaning * match zero or more characters in this field - match one character in this field ? (same as "-") % (same as "-") For example, in the command >SRD M* the filename field of "M*" specifies all files with "M" as the first character in the name. In contrast, the filename specification "M" matches only those files that have the filename "M". Thus, the pattern "M*" matches a file with the name "MAINPGM", while the pattern "M" does not. Note that the filetype and version fields are wildcards by default. >SRD M---X* This command specifies all files with names that start with "M", have any characters in the second, third, and fourth positions, and have "X" in the fifth position. The "*" matches everything. The wild character "*" can be used anywhere in the filename and filetype fields: at the beginning, intermediate, or end positions. For example, >SRD A*E?G specifies all files with names that start with an "A", have any number of characters (including zero), and then have an "E" followed by any single character, and then a "G". The result is the same as a single-command combination of the commands >SRD AE-G >SRD A-E-G >SRD A--E-G >SRD A---E-G >SRD A----E-G >SRD A-----E-G Another example is: >SRD *PGD* This command selects all files having "PGD" anywhere in the filename, such as PGD.MAC, PGDATA.MAC, or BIGPGDBLD.CMD. Page 4 If the version is specified, it has the usual meaning: -1 for oldest, 0 for highest, any other number is itself. The wildcard ("*") specifies all versions. If "n" is omitted, the default depends upon whether the processor switch /CM is used on the command line or not. If it is not, the default is the wildcard: all versions. If the processor switch is present, the default is 0 (highest version only). Any options can be used following either the "outfile" specification or the "infile" specification or both. The switches fall into four categories: output form switches (/TB, /BR, /LI, /FU, /SP, /CM, /ID), sort switches (SN, ST, SV, DN, DT, DV, SR), selection switches (/NE, /NV, /OV, /HV, /RD, /CD, /DA, /BE, /AF, /CO, /LO, /MU), and maintenance switches (/SD, /DE, /PU, /WB). The defaults are: >SRD TI:DIRECTORY.LST/-SP=SY:*.*;*/SN:ST:SV/BR/CD SRD must read the entire directory into memory before sorting it. The size of its buffer can be increased by installing SRD with an increment. On an RSX-11M system, SRD will try expand itself dynamically. If it cannot fit the entire directory in memory, SRD will give a warning message and do the directory in chunks. Each chunk will be sorted separately, however. A write-back will be cancelled in this case. Page 5 OUTPUT FORM SWITCHES SPOOL OUTPUT /SP This switch causes SRD to spool the output file. The default is /-SP. NOTE All of the output form switches described below are mutually incompatible; no more than one can be used on a command line. IDENT /ID This switch causes the current version of SRD to be displayed. LIST SUMMARY LINE (TOTAL BLOCKS) FOR SELECTED FILES /TB This switch causes SRD to a header line and a trailer line for each directory. The header line identifies the UIC and gives the date; the trailer shows the total number of blocks used and allocated for the selected files, the number of files selected, and the total number of files in the directory. LIST FILENAMES OF SELECTED FILES /BR In addition to header and trailer lines for each directory, the filename (including type and version) of each selected file is listed. STANDARD LISTING /LI In addition to the header and trailer lines for each directory, the following information is listed for each Page 6 selected file: 1. File name (including type and version) 2. File size - blocks used (decimal) 3. Symbols for contiguous, locked, or multi-header files (C, L, M) 4. Creation date and time FULL LISTING /FU[:n] The /FU switch is similar in function to the /LI switch, but it includes the following information as well in the output listing: 1. File I.D. 2. File size - blocks used and blocks allocated (decimal values) 3. Creation and revision date and time and revision number (if greater than 1) 5. Owner UIC 6. Protection The optional subswitch "n" specifies that maximum line length in the output. The default is 132. for a file and the buffer size for a device. COMMAND FORMAT /CM[:xxx[:ffff]] This switch produces a listing of files in a form suitable for a command file. That is, the output can contain, for each file, a line of the standard form xxx outfile,listfile=infile.typ;ver,infile where "outfile", "listfile", and "infile" are all the same name, that of each of the selected files. The field "xxx" represents the processor name, as provided in the first subswitch of the /CM switch. The second subswitch controls the actual format of the output line. This subswitch can contain any of the letters "O", "L", "T", "V", and "S", in any order. The meaning of these letters is as follows: Page 7 letter meaning O provide "outfile" field L provide "listfile" field T provide type for first "infile" V provide version number in first "infile" field S provide second "infile" field (always with version ";0") If the second subswitch is not specified, then the default form for each output line is "infile" only. For example, if a user account contains only the files MAIN.MAC;10, SUB1.MAC;7, SUB2.MAC;2, SUB2.MAC;3, AND SUB3.FOR;6, then the command >SRD MAINBLD.CMD=/CM:MAC would produce file MAINBLD.CMD containing only the lines MAC MAIN MAC SUB1 MAC SUB2 MAC SUB3 and the command >SRD SUBASM.CMD=S*.MAC/CM::TVLO would produce file SUBASM.CMD containing only the lines SUB1,SUB1=SUB1.MAC;7 SUB2,SUB2=SUB2.MAC;3 Such a file could be used in the subsequent command >MAC @SUBASM Any string not containing "/", ":", or "=" can be used for the processor name. That is, the processor name can include "@", or it can be a null string. Note that, when the /CM switch is used, the default version in the "infile" field of the command line is ";0". If a wildcard is explicitly used for the version, then the "V" should be used in the second subswitch to avoid duplicate lines in the output file, for files that have multiple versions. Page 8 SORT SWITCHES AND SUBSWITCHES The sort switches are used as switches and subswitches (that is, separated by colons). Any of the sort switches can appear first; the order in which they appear determines the major and minor keys for the sort. The sort keys are the filename (corresponding to sort switches SN and DN), the filetype (ST and DT), and the file version number (switches SV and DV). The first switch to appear specifies the major sort key; subsequent subswitches specify sort keys of decreasing importance. The default is "/SN:ST:SV". If only one key is specified, the other keys are still used according to the default ordering. For example, the switch "/SV" implies "/SV:SN:ST". ASCENDING SORT BY FILENAME /SN This switch/subswitch specifies an ascending sort by filename. If first in the switch/subswitch sequence, the files are sorted by name first. ASCENDING SORT BY FILETYPE /ST This switch/subswitch specifies an ascending sort by filetype. If first in the switch/subswitch sequence, the files are sorted by type first. ASCENDING SORT BY VERSION NUMBER /SV This switch/subswitch specifies an ascending sort by version number. If first in the switch/subswitch sequence, the files are sorted by version first. DESCENDING SORT BY FILENAME /DN This switch/subswitch specifies a descending sort by filename. If first in the switch/subswitch sequence, the files are sorted by name first. Page 9 DESCENDING SORT BY FILETYPE /DT This switch/subswitch specifies a descending sort by filetype. If first in the switch/subswitch sequence, the files are sorted by type first. DESCENDING SORT BY VERSION NUMBER /DV This switch/subswitch specifies a descending sort by version number. If first in the switch/subswitch sequence, the files are sorted by version first. NOTE Sorting can be turned off if the files are not being listed or written back. To specify no sorting, use "-" on one any of the sort switches or use /-SR. If sorting is turned off when the files are to be listed, then they are listed in the order that they appear in the directory. This is the same order in which PIP lists them. Page 10 SELECTION SWITCHES NEGATE "INFILE" SELECTION /NE This switch causes the files selected to be those that do NOT match the specified filename/filetype/version pattern. For example, >SRD S*/NE selects all files that do not start with "S". Note that this switch does not reverse the meanings of any of the selection switches described below. NEW VERSION /NV[:n] This switch restricts the listing of file names to only the "n" highest (newest) versions. The default value for "n" is 1. OBSOLETE VERSION /OV[:n] This switch restricts the listing of file names to all versions except the "n" highest versions. The default value for "n" is 1. For a given "n", "/OV:n" lists file names not listed by "/NV:n", and the files listed are those that would be deleted if "/PU:n" were specified. HIGHER OR SAME VERSION /HV[:n] This switch can be used to cause SRD to list only files that have a version higher or equal to a specified value. The default value for "n" is 2. For example: >SRD /HV:10 causes the listing of files with version 10(octal) or higher only. This is useful in the case where files are copied to an alternate source, and then edited. SRD will produce a listing of any changed files. For example: Page 11 ; ; CREATE WORK COPY OF MASTER FILES ; >PIP DK3:*.*;100=SY:*.* - later - ; ; LIST ALL CHANGED FILES ; >SRD DK3:/HV:101 DATE /DA[:dd-mmm-yy] or /DA[:ddmmmyy] This switch specifies selection of files created on the specified date. If no date is specified, the current date is used. The creation date is used unless /RD is also specified. BEFORE: /BE[:dd-mmm-yy][-E] or /BE[:ddmmmyy][-E] This switch causes the selection of only those files that were created (or revised) before the specified date. To include files created on the specified date, the subswitch "-E" must also be specified. If no date is given, the current date is used. If both /BE and /AF are specified, only files created (or revised) between the dates are selected. The creation date is used unless /RD is also specified. AFTER: /AF[:dd-mmm-yy][-E] or /AF[:ddmmmyy][-E] This switch causes the selection of only those files that were created (or revised) after the specified date. To include files created on the specified date, the subswitch "-E" must also be specified. If no date is given, the current date is used. If both /BE and /AF are specified, only files created (or revised) between the dates are selected. The creation date is used unless /RD is also specified. USE REVISION DATE /RD Page 12 On the date selection, use the revision date (if there is none, the creation date is used). The switch /-RD is equivalent to the switch /CD. USE CREATION DATE /CD On the date selection, use the creation date (this is the default). The switch /-CD is equivalent to the switch /RD. CONTIGUOUS FILES /CO This switch causes SRD to select only files which are contiguous. LOCKED FILES /LO This switch causes SRD to select only files which are locked. MULTI-HEADER FILES /MU This switch causes SRD to select only files which have multiple headers. Page 13 MAINTENANCE SWITCHES SELECTIVE DELETE /SD This switch causes SRD to list the selected files, one at a time, with a confirming prompt that asks if the file should be deleted. The first character of the response specifies the action to be taken: "Y" (yes) - Delete the file. "N" (no) - Do not delete the file. "G" (go) - Delete the rest of the selected files, without prompt. "Q" (quit) - Quit. Any other response is interpreted as "N" (no). If "G" (go) is entered, the question "ARE YOU SURE?" is asked in order to be sure that it is the proper response. All the previously specified options for selection may be used, eg: >SRD MAK*/DA/SD causes SRD to select all the files created on the current date with the first three characters in the name "MAK" to listed for selective deletion. DELETE ALL SELECTED FILES /DE This switch causes SRD to delete all selected files after listing, without prompting. If the listing is not desired, the -BR switch can be applied. For example: SRD /BE:1-JAN-76/DE causes SRD to delete all files created before January 1, 1976. NOTE The use of this switch is not recommended; /SD should be used instead, because of the confirmation that it provides. Page 14 PURGE /PU[:n] This option is used to delete all versions of a file except the "n" highest versions. All of the normal selection options apply. The user is prompted for each file to be deleted as described in the selective delete section above. For example: >SRD *.MA*/NE/PU:2 causes SRD to delete all except the highest two versions of all files that have type not starting with "MA". NOTE The full listing switch can be applied to any of the above. WRITE-BACK THE DIRECTORY /WB This switch causes SRD to write the directory back in the sorted order specified. This not only orders the directory, but compresses it as well. This reduces search time by the FILES-11 ACP if many files have previously been deleted from the directory. For example, the command >SRD [100,101]/-BR/WB causes SRD to read the directory [100,101], sort it, then write it back without generating a listing. Write Access to the directory is required and Write Failure is usually due to a protection violation. In the event of a write-back failure, the operation is attempted several times. NOTE Since /WB rewrites your directory, be sure that you have an adequate backup in case a failure occurs. Page 15 ***** EXAMPLES ***** >SRD MAK*/DA/SD Prompt for selective deletion for all files whose filename starts with "MAK", which have been created on the current date. >SRD /SD This allows selective deletion of ALL files in the current UIC. >SRD /BE:1-JAN-76/DE Delete all files created before 1-Jan-76. >SRD [100,101]/-BR/WB Read the directory [100,101], sort the directory, then write it back. The individual filenames will not be listed. >SRD [*,*]*.MAC/TB Scan all UFD's for all the ".MAC" files. Do not list the individual filenames, but for each directory list the number of files (both *.MAC and total) and the number of blocks used/allocated for the ".MAC" files. >SRD [*,*]/TB/BE:1-MAY-79-E For all UFDs, show the number of files (and the number of blocks they occupy) that were created on or before May 1, 1979. This is handy to use to find old files that might be eligible for being rolled off-line. Page 16 Appendix A. Summary of SRD Switches /AF[TER][:dd-mm-yy[-E]]... Select only files created after (or on, with -E) the specified date. /BE[FORE][:dd-mm-yy[-E]].. Select only files created before (or on, with -E) the specified date. /BR[IEF].................. List filenames and /TB information (default). /CD....................... Use creation date for date selection (default). /-CD...................... (equivalent to /RD). /CM[D][:xxx[:OLTVS]]...... List filenames in a form suitable for a command file (with processor "xxx"). /CO[NTIGUOUS]............. Select only files that are contiguous. /DA[TE][:dd-mm-yy]........ Select only files created on the specified date. /DE[LETE]................. Delete selected files without specific confirming question. /DN....................... Sort by name, descending (positional switch or subswitch). /DT....................... Sort by type, descending (positional switch or subswitch). /DV....................... Sort by version, descending (positional switch or subswitch). /FU[LL][:n]............... List the directory as with /LI, but also with file id., revision date, owner UIC, and protection information. /HV[:n]................... Select only files with version higher than or the same as "n". /ID[ENT].................. Display SRD version identification. /LI[ST]................... List the directory as with /BR, but also with sizes and creation dates. Page 17 /LO[CKED]................. Select only files that are locked. /MU[LTIHEADER]............ Select only files with multiple headers. /NE[GATE]................. Select only files that do not match the "infile" specification. /NV[:n]................... Select only highest "n" versions. /OV[:n]................... Select all but the "n" highest versions. /PU[RGE][:n].............. Delete all but the "n" highest versions of files selected. /RD....................... Use revision date for date selection. /-RD...................... (equivalent to /CD). /SD....................... Selectively list and delete specified files, with specific confirmation request. /SN....................... Sort by name, ascending (positional switch or subswitch; default in first position). /SP[OOL].................. Spool output file to line printer. /-SP[OOL]................. Do not spool output (default). /SR....................... Sort the file directory before listing (default). /-SR...................... Do not sort the file directory. /ST....................... Sort by type, ascending (positional switch or subswitch; default in second position). /SV....................... Sort by version, ascending (positional switch or subswitch; default in third position). /TB....................... List the header, trailer, and total blocks. /WB....................... Write directory back in sorted form.