Shell Commands/List

From MorphOS Library

Revision as of 12:02, 3 March 2015 by JPV (talk | contribs) (Created page with "'''List''' - Lists the contents of the specified directory 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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

< Shell Commands

List - Lists the contents of the specified directory

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, SORT/K, USERS/S, GROUPS/S, ALL/S

DIR     - directory, filename or pattern to match                              
PAT     - if specified, only files/dirs matching this pattern will be listed
KEYS    - displays the block number of each file header or directory
DATES   - displays the dates
NODATES - do not display the dates
TO      - specifies an output file or device for List;
          by default, List outputs to the current window
SUB     - lists only files containing the substring SUB
SINCE   - lists only files timestamped on or after the specified date
UPTO    - lists only files timestamped on or before the specified date
QUICK   - lists only the names of files and directories
BLOCK   - displays file sizes in 512-byte blocks, rather than bytes
NOHEAD  - suppresses printing of the header and summary information
FILES   - lists files only (no directories)
DIRS    - lists directories only (no files)
LFORMAT - defines a string to specially format List output
SORT    - see below
USERS   - shows user owner of the files
GROUPS  - shows groups which the files belong to
ALL     - lists the contents of all directories and subdirectories

the 'SORT' keyword requires any of N=NAME, D=DATE, S=SIZE, RN=REVERSENAME, RD=REVERSEDATE,RS=REVERSESIZE

The LFORMAT option modifies the output of List and can be used as a quick method of generating script files. When using LFORMAT, specify an output format string; this string is output for each file or directory normally listed. It can contain any text you specify, plus the usual List output information. When LFORMAT is specified, the QUICK and NOHEAD options are automatically selected. To save the output, you must redirect it to a file by using the > operator or specifying a TO file.

The available substitution operators 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 number.
%L  Prints the length of the file in bytes.
%M  Prints the file name only, omitting any extension.
%N  Prints the name of the file.
%P  Prints the file parent path.
%S  Superseded by %N and %P; still functional.
%T  Prints the time associated with the file.

You can put a length specifier 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 is right justified.

NOTE: The default output of the LIST command uses the following specification: %-24 %7L %A %D %T