PDIR |
|
| Purpose: | Display information about files and subdirectories in user-definable fields. It is a "programmable DIR" command. |
| Format: | PDIR [ranges] [/A:[attrlist] /D /H /I"text" /K /M /N[dej] /O[[:][order] /P /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 |
/A: |
Attribute select |
Disable options |
|
colorize |
Order |
||
do not Hide . and .. |
Page pause |
||
/I"text" |
description range |
Subdirectories |
|
show header |
/T[:t] |
Timestamp type |
|
show footer |
output fields and format |
See also: DIR, ATTRIB, DESCRIBE, and SELECT.
File Selection
Supports attribute switches, extended wildcards, ranges, multiple file names, and include lists.
Internet
Can be used with FTP/HTTP Servers.
Usage
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:
| a | Attributes |
| 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) |
| P | SFN path |
| p | LFN path |
| N | SFN filename |
| n | LFN filename (default) |
| i | Description |
| 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) |
| z[...] | Size |
| a | allocated size (this will usually be more than the physical size unless the file is compressed.) |
| 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. |
@function[*]
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:
[-]i.a
where
- 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 filed will be padded with zeros instead of spaces.
Example
To display the CRC, the full LFN and the owner of each file:
pdir /(r fpn q) *
Options
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:. |
| /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 |
| j | Skip junctions (when used with /S) |
| 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 |
| u | Unsorted |
| /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.
| /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. |