|Purpose:||Display information about files and subdirectories in user-definable fields. It is a "programmable DIR" command.|
|Format:||PDIR [ranges] [/A:[attrlist] /B /D /H /HL /I"text" /K /M /N[defhjlsv] /O:[order] /P /Q /S[[+]n] /T:t /(...)] [file...]|
|attrlist||Selection attributes (see attribute switches for details)|
|order||Hierarchical list of sort keys|
|ranges||One or more date, description, exclusion, size, time ranges|
|file||One or more files to list|
|t||Timestamp type selection code|
do not Hide . and ..
output fields and format
Can be used with FTP/HTTP Servers.
PDIR is an extremely flexible command allowing you to display information about files and directories from one or more local or remote volume or directories in a wide array of user-defined formats. For a simpler version, see the DIR command.
PDIR and DIR are related, but they do not have identical switches and they are not intended to produce identical output. PDIR is primarily intended to produce output that will be subsequently parsed by another program (or batch file), or (more rarely) for a special-purpose directory display. Its options and output are geared towards those applications.
The various PDIR displays are controlled through options or switches. The best way to learn how to use the many options available with the PDIR command is to experiment. You will soon know which options you want to use regularly. You can then select those options permanently by using the ALIAS command.
The /(...) option specifies which fields you want to display and how to format them. (You can have multiple /(...) options on a line.) The syntax is:
|c||Compression: Display the compression percentage on NTFS drives with compression enabled.|
|d[...]||Date (you must specify at least one subfield, otherwise the field remains blank)|
|d||day (2 digits, leading zero)|
|m||month (2 digits, leading zero)|
|y||year (4 digits)|
|f[...]||File or Directory name (case sensitive)|
|n||LFN filename (default)|
|q||Enclose the filename in double quotes if it contains whitespace or special characters|
|m||MD5 hash value (see the @MD5 function)|
|q||File or directory owner (NTFS only)|
|r||CRC32 hash value (see the @CRC32 function)|
|s||stream names (NTFS only)|
|sp||path and stream names as pathname+filename+streamname (NTFS only)|
|t[...]||Time (you must specify at least one subfield, otherwise the field remains blank)|
|h||hours (2 digits, leading zero)|
|m||minutes (2 digits, leading zero)|
|s||seconds (2 digits, leading zero)|
|d||milliseconds (decimal separator and 3 digits)|
|a||Allocated size (this will usually be more than the physical size unless the file is compressed.) Note that you cannot get the allocated size on FTP servers or network sharenames.|
|c||The size will be formatted using the thousands separator (default is a comma)|
|k|K|m|M|g|G|t|T||(case sensitive) format as kilobytes, megabytes, gigabytes, or terabytes, as used in variable functions (see Memory Size / Disk Space / File Size Units and Report Format). Note that the size will be truncated, not rounded.|
|call the specified variable function (internal or user-defined). To specify the current filename, use * as the parameter. For example, pdir /(f @md5[*]) displays the filename and the MD5 hash. Note that the % prefix of the function name is NOT used with the symbolic * parameter. If the parameter of the function is not the symbolic * or it is an "inner" function the % prefix must be doubled, e.g., @function1[%%@function2[*]]|
|"..."||Literal string (in quotes). Characters are displayed as is, except that escape characters are converted.|
You can also specify a format, independently for each field, by prefixing the field character with its format specification:
- specifies left justification instead of the default, right justification;
i specifies the minimum field width, and
a specifies the maximum field width.
If the first digit of i is 0, the field will be padded with zeros instead of spaces. Some fields cannot be reduced below a minimum width (for example, the z (size) field is a minimum of 15 digits).
If a PDIR line is empty (for example, if you have an embedded @IF), it will not be displayed.
If you want to append fields with no intervening whitespace, or with a custom delimiter character, you can use double quotes to specify arguments. For example, to display the date and time with no space between them:
pdir /(dymd""thms) *
Or to display the date and time separated by a +:
pdir /(dymd"+"thms) *
PDIR sets three internal variables:
|%_pdir_dirs||The number of directories created|
|%_pdir_files||The number of files moved|
|%_pdir_errors||The number of errors|
To display the CRC, the full LFN and the owner of each file:
pdir /(r fpn q) *
Options on the command line apply only to the filenames which follow the option, and options at the end of the line apply to the preceding filename only. This allows you to specify different options for different groups of files, yet retains compatibility with the traditional DIR command when a single filename is specified.
Most options are used to select the desired files/directories. (This is in contrast to the DIR command.) The special option /(...) is used to specify which characteristics of the selected files or directories should be displayed in which sequence and format.
|/A:...||Display only those files that have the specified attribute(s) set. See Attribute Switches for information on the attributes which can follow /A:.|
You can specify /A:= to display a dialog to help you set individual attributes.
|/B||Suppress the header and summary lines, and display file or subdirectory names only, in a single column. This option is most useful when you want to redirect a list of names to a file or another program. If you use /B with /S, PDIR will show the full path of each file (the same display as /F) instead of simply its name and extension. If you use /B with /X on an LFN drive, PDIR will display the short name of each file instead of the long name. /B also sets /H.|
/B1 will display relative paths when used with /S. (Normally, /B shows the full pathname for the file.)
|/D||Colorize the directory listing. See DIR for more information on directory colorization.|
|/I"text"||Select filenames by matching text in their descriptions. See Description Ranges for details.|
|d||Skip hidden directories (when used with /S)|
|e||Don't display errors|
|f||Suppress bytes free in the footer|
|h||Suppress the header|
|j||Skip junctions (when used with /S)|
|l||Don't display link name for symbolic links|
|m:n||Display a maximum of n directory entries|
|s||Suppress the footer|
|v||Suppress the volume label in the header|
|/O...||The sorting order is applied to the listings of each subdirectory separately. Any combination of the sorting options may be used. If multiple options are specified, the listing will be sorted with the first sort option as the primary key, the next as the secondary key, and so on.|
|n||Sort by filename and extension (default). If e is also specified, sort by name only.|
|-||Reverse the sort order for the next option|
|a||Sort names and extensions in standard ASCII order, rather than sorting numerically when digits are included in the name or extension.|
|c||Sort by compression ratio (the least compressed file in the list will be displayed first).|
|d||Sort by date and time (oldest first); also see /T:acw|
|e||Sort by extension|
|g||Group subdirectories first, then files|
|i||Sort by file description (ignored if /C or /O:c is also used).|
|o||Sort by owner|
|r||Reverse the sort order for all options|
|s||Sort by size|
|t||Same as d|
|x||When combined with /S, sorts the results from all directories together and displays them in a single listing. (Unless you're also specifying /F, you probably won't get a comprehensible result.) Note that /O:x will turn off headers and footers.|
|/P||Wait for a key to be pressed after each screen page before continuing the display. Your options at the prompt are explained in detail under Page and File Prompts.|
If you specify a number after the /S, PDIR will limit the subdirectory recursion to that number. For example, if you have a directory tree "\a\b\c\d\e", /S2 will only affect the "a", "b", and "c" directories.
If you specify a + followed by a number after the /S, PDIR will not display any filenames until it gets to that depth in the subdirectory tree. For example, if you have a directory tree \a\b\c\d\e, /S+2 will not display the contents of \a or \a\b.
|/T:type||Specifies which single one of the date and time fields below, available on a drive which supports long filenames, should be displayed and used for sorting:|
|a||Last access date and time (NTFS volumes).|
|c||Creation date and time.|
|w||Last write date and time (default).|
If /T is not specified, the default is /T:w.
If you append a u after the field, DIR will display the file time in UTC.
Note: If more than one time type is specified, the first one specified is used, and all subsequent ones ignored.
|/(...)||Use this option to define the various fields and display formats you wish to use for each selected entry. The fields may be in any order, and may be repeated. If this option is not used, the output format is identical to that of the DIR command. If you specify multiple /(...) options, PDIR will insert a space in the output between each one.|