ZDIR — Display directory entries in the old style

Synopsis

ZDIR [/?] [/A[+|-]drash] [/S[+|-]drash] [/O[[+|-]ANEDSG]] [/T[acw]] [/L [number]] [/W [number]] [/LOCALFORMAT] [/UTC] [/COLOUR] [/MONO] [/OLDSRCDIR[+|-]] [/E/U/B/D/H/P/Q[+|-]] Filespecs

Options

/?
Display command syntax information.
/A
Select files by attribute.
/S
Recurse into subdirectories.
/E
Do not display non-fatal error messages.
/U
Do not display summary information.
/Q
Operate quietly.
/B
Display the output in "bare" format, without size, date, or attribute information.
/D
Do not display the directory name header.
/H
Do not display the "." and ".." entries.
/L
Specify how names should be mangled, by specifying one of the following numbers:
0
Perform no conversion (default if /L not used).
1
Convert everything to lower case (default if no number supplied).
2
Convert everything to upper case.
3
Convert everything to mixed case.
4
Convert directories to upper case and files to lower case ("Petercase").
/N
Compatibility option. This option does nothing.

Note: This option is present for backwards compatibility only. Its use should be avoided. In future releases of the ZDIR command this option will be removed, since the standard meaning for this option of simulate execution has no applicability to the ZDIR command. It is only present to ease the use of the ZDIR command as a replacement for the DIR command.

/O
Specify a sort string that determines how the output should be sorted, comprising zero or more of the following characters (optionally preceded by '-' to reverse the sense):
A
Sort by name, treating digits as numbers.
D
Sort by date and time stamp (according to the /T option).
E
Sort by extension (the part of the name following the final full stop).
G
Sort by attribute (directories, then hidden and system files, then all other files).
N
Sort by name.
S
Sort by size.
I
Sort by the value of the .SUBJECT extended attribute.
/P
Pipe the standard output and standard error to a pager command.

Note: This option is present for backwards compatibility only.

/T
Specify which dates and times to display and to sort on, by specifying one or more of the following characters:
A
Display the last access date and time.
C
Display the creation date and time.
W
Display the last write date and time.

The dates and times are displayed in the order that they are specified. The default is the same as if /TW had been used.

/W
Display the output in "bare" format, without size, date, or attribute information, and displaying multiple columns per line. The optional number argument specifies the line width to use. If it is not specified, the width of the console (if standard output is a console) is used.
/X
Do not display the header and footer containing the label, serial number, and free space of the volume.
/MONO
Prevent colours from being used.
/COLOUR
Force colours to be used.
/LOCALFORMAT
Use the local country's date and time formats.
/UTC
Display date/time stamps in UTC rather than local time.
/OLDSRCDIR
Duplicate quirks of the 16-bit CMD supplied with IBM OS/2 with respect to source names.

Description

The ZDIR command displays the directory entries of all files that match the given search wildcard specifications. If no wildcard specifications are supplied, the default is to display the entries in the current directory.

The ZDIR command first processes the contents of the CMD_ZDIR_INIT environment variable, if it has inherited one, as if it were a command tail, before processing any of the command tails that have been passed to it. This allows one to modify default options globally. (One can use command aliases or wrapper scripts to achieve the same effect.)

By default, the basename, last write time, size, attribute flags, and description (value of the .SUBJECT extended attribute) of the file are displayed. Only up to 12 characters of the basename are displayed. If the base name is longer than 12 characters, its first 12 characters are printed followed by a triangle character.

If ZDIR detects that its standard output is neither a pipe nor a file, it will wrap the description onto multiple lines. Otherwise, it will output the description on a single line.

If the /P option is specified, ZDIR will pipe its standard output and standard error through a pager command. The pager command is specified by the contents of the PAGER environment variable. If there is no PAGER environment variable, the MORE command is used as the default pager command.

ZDIR invokes the pager command indirectly, by passing it as an argument to the command interpreter given by the COMSPEC environment variable (defaulting to "CMD" if that environment variable does not exist). So, for example, the pager command could be a command script, or a built-in command, or a command pipeline.

If ZDIR detects that its standard output is neither a pipe nor a file, it will send escape sequences to its standard output to change the colour of directory entries as specified in the DIR_COLOURS environment variable. This can be overridden by using the /MONO and /COLOUR options, to explicitly force or prevent the use of these escape sequences respectively.

ZDIR matches the colouring rules using the base part of the filename and the file's attributes, and applies each rule in order until one matches. If none of the colouring rules in the DIR_COLOURS environment variable match a file, or if the DIR_COLOURS environment variable does not exist, ZDIR will send escape sequences to change to white on black. To override this, append a colouring rule with "*" as its wildcard specification to the end of the DIR_COLOURS environment variable.

If colouring is used, ZDIR will change to white on black at the end of each directory entry displayed. It will do this before sending the newline sequence in order to prevent unsightly results if the screen happens to scroll up when the newline is sent.


The 32-bit Command Interpreter is © Copyright Jonathan de Boyne Pollard. "Moral" rights are asserted.