PDIR

Print Topic  Return to Overview  Previous Topic  Next Topic 
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...]

 

attrlistSelection attributes (see attribute switches for details)
orderHierarchical list of sort keys
rangesOne or more date, description, exclusion, size, time ranges
fileOne or more files to list
tTimestamp type selection code

 

/A:

Attribute select

/N

Disable options

/D

colorize

/O

Order

/H

do not Hide . and ..

/P

Page pause

/I"text"

description range

/S

Subdirectories

/K

show header

/T[:t]

Timestamp type

/M

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:

 

aAttributes

 

cCompression:  Display the compression percentage on NTFS drives with compression enabled.

 

d[...] Date (you must specify at least one subfield, otherwise the field remains blank)
dday (2 digits, leading zero)
mmonth (2 digits, leading zero)
yyear (4 digits)

 

f[...]File or Directory name (case sensitive)
PSFN path
pLFN path
NSFN filename
nLFN filename (default)

 

iDescription

 

mMD5 hash value (see the @MD5 function)

 

qFile or directory owner (NTFS only)

 

rCRC32 hash value (see the @CRC32 function)

 

sstream names (NTFS only)

 

sppath and stream names as pathname+filename+streamname (NTFS only)

 

t[...]Time (you must specify at least one subfield, otherwise the field remains blank)
hhours (2 digits, leading zero)
mminutes (2 digits, leading zero)
sseconds (2 digits, leading zero)
dmilliseconds (decimal separator and 3 digits)

       

z[...]Size
aallocated size (this will usually be more than the physical size unless the file is compressed.)
cthe 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:.

 

/DColorize the directory listing.  See DIR for more information on directory colorization.

 

/HShow the "." and ".." directory names (normally suppressed).

 

/I"text"Select filenames by matching text in their descriptions. See Description Ranges for details.

 

/KShow the header (disk and directory name) display.

 

/MShow the footer (file and byte count totals) display.

 

/NTurn off the specified options.

 

dSkip hidden directories (when used with /S)
eDon't display errors
jSkip junctions (when used with /S)

 

/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.

 

nSort by filename and extension (default). If e is also specified, sort by name only.
-Reverse the sort order for the next option
aSort names and extensions in standard ASCII order, rather than sorting numerically when digits are included in the name or extension.
cSort by compression ratio (the least compressed file in the list will be displayed first).
dSort by date and time (oldest first); also see /T:acw
eSort by extension
gGroup subdirectories first, then files
iSort by file description (ignored if /C or /O:c is also used).
oSort by owner
rReverse the sort order for all options
sSort by size
tSame as d
uUnsorted

 

/PWait 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.

 

/SDisplay file information from the current directory and all of its accessible subdirectories.

 

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:

 

aLast access date and time (NTFS volumes).
cCreation date and time.
wLast 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.

 

Topic "pdir.htm" last edited 5/12/2008. ©2008  JP Software, Inc.
Keywords: PDIR,DIR