[AmigaOS / ApolloOS Command Reference\List] 
 

LIST

Format: LIST [{<dir|pattern|filename>}] [P|PAT <pattern>] [KEYS] [DATES] [NODATES] [TO <name>] [SUB <string>] [SINCE <date>] [UPTO <date>] [QUICK] [BLOCK] [NOHEAD] [FILES] [DIRS] [LFORMAT <string>] [ALL] Template: DIR/M, P=PAT/K, KEYS/S, DATES/S, NODATES/S, TO/K, SUB/K, SINCE/K, UPTO/K, QUICK/S, BLOCK/S, NOHEAD/S, FILES/S, DIRS/S, LFORMAT/K, ALL/S Purpose: To list specified information about directories and files. Path: C:LIST Specification: LIST displays information about the contents of the current directory. If you specify a <dir>, <pattern>, or <filename> argument, LIST will display information about the specified directory, all directories or files that match the pattern, or the specified file, respectively. Unless other options are specified, LIST displays the following: name The name of the file or directory. size The size of the file in bytes. If there is nothing in this file, the field will read empty. For directories, this entry reads Dir. protection The protection bits that are set for this file are shown as letters. The clear (unset) bits are shown as hyphens. Most files will show the default protection bits, ----rwed for readable/writable/ executable/delete-able. See the PROTECT command for more on protection bits. date and time The date and time the file was created or last changed. comment The comment, if any, placed on the file using the FILENOTE command. It is preceded by a colon (:). LIST has options which will change the way the output is displayed. These options are:

KEYS

Displays the block number of each file header or directory. This is mostly useful to programmers.

DATES

Displays dates in the form DD-MMM-YY (the default unless you use QUICK).

NODATES

Will not display date and time information.

TO <name>

Specifies an output file or device for LIST; by default, LIST outputs to the current window.

SUB <string>

Lists only files containing the substring <string>.

SINCE <date>

Lists only files created on or after the specified date.

UPTO <date>

Lists only files created on or before the specified date.

QUICK

Lists only the names of files and directories.

BLOCK

Displays file sizes in blocks, rather than bytes.

NOHEAD

Suppresses the printing of the header information.

FILES

Lists files only (no directories).

DIRS

Lists directories only (no files).

LFORMAT

Defines a string to specially format LIST output.

ALL

Lists all files in directories and subdirectories. The LFORMAT option modifies the output of LIST and can be used as a quick method of generating script files. When LFORMAT is specified, the QUICK and NOHEAD options are automatically selected. When using LFORMAT you must specify an output format specification string; this string is incorporated into the script file. If you want the output to be saved, you must redirect it to a file by using the > operator or specifying a TO file. The format for the output format specification string is LFORMAT=<string>. To include the output of LlST in this string, use the substitution operator %S. The path and filename can be made part of the string this way. Whether the path or the filename is substituted for an occurrence of %S depends on how many occurrences are in the LFORMAT line, and their order, as follows: Occurrences of %S 1st 2nd 3rd 4th 1 filename 2 path filename 3 path filename filename 4 path filename path filename When using %S, the path is always relative to the current directory. Some new options allow you to specify fields to be printed in the LFORMAT output. These options are: %A Prints file attributes (protection bits). %B Prints size of file in blocks. %C Prints any comments attached to the file. %D Prints the date associated with the file. %E Prints just the file extension. %K Prints the file key block. %L Prints the length of file in bytes. %M Prints filename only, omitting any extension. %N Prints the name of the file. %P Prints the file parent path. %T Prints the time associated with the file. You can put a length specifer and/or a justification specifier between the percent sign (%) and the field specifier. To specify left justification, place a minus sign (-) before the length specifier. Otherwise, the information displayed will be right justified. Example 1: 1> LIST Dirs Monitors Dir rwed 27-Jun-90 11:43:59 T Dir rwed 16-Jul-90 11:37:43 Trashcan Dir rwed 21-Jun-90 17:54:20 Only the directories in the current directory, in this case SYS:, are listed. (A shortened version of the typical output is shown above.) Example 2: 1> LIST Li#? TO RAM:Libs.file LIST will search for any directories or files that start with LI. The output of LlST will be sent to Libs.file in RAM:. Example 3: 1> LIST DF0:Documents UPTO 09-Oct-90 Only the files or directories on the Documents directory of DF0: that have not been changed since October 9, 1990 will be listed. Example 4: 1> LIST >RAM:Scriptnotes #? LFORMAT="filenote %S%S Testnote" A new script file, Scriptnotes, is created in RAM:. The contents will include a list of all the files in the current directory. When Scriptnotes is executed, it will add the filenote Testnote to each file. For example, if the current directory is S:, the contents of Scriptnotes as produced by this command might look like this: filenote s:HDBackup.config Testnote filenote s:DPat Testnote filenote s:Ed-startup Testnote filenote s:PCD Testnote filenote s:Shell-startup Testnote filenote s:SPat Testnote filenote s:Startup-sequence Testnote Example 5: 1> LIST Testfile LFORMAT "%-25N %L %12A %D Testfile 28 ----rwed 28-May-92 %-25N specifies that the length of the field containing the name of the file is to be 25 characters long (25), and the text is to be left justified (-). %12A specifies that the length of the field containing the file attributes is to be 12 characters long (12), and the text is to be right justified.