The program d is a command line utility that lists the files in one or more directories. It is much like dir in DOS, or ls in the standard Linux shells.
In addition to the normal functions of a directory program, it can calculate file size totals at any desired resolution. This is useful for providing an overview of disk usage.
> d c:\windows\*** -resolution=20mb
76.6 Mb c:\windows\$hf_mig$\***\
305.8 Mb c:\windows\$NtServicePackUninstall$\***\
36.3 Mb c:\windows\$xpsp1hfm$\***\
76.7 Mb c:\windows\Driver Cache\I386\DRIVER.CAB
22.3 Mb c:\windows\Driver Cache\I386\sp2.cab
22.8 Mb c:\windows\Fonts\
48.7 Mb c:\windows\Help\SBSI\Training\WXPPRO\Content\Lib\
47.7 Mb c:\windows\Help\SBSI\Training\WXPPRO\Content\Wave\
20.2 Mb c:\windows\Help\Tours\mmTour\
38.5 Mb c:\windows\Help\***\
56.9 Mb c:\windows\INF\
27.2 Mb c:\windows\Installer\***\
41.7 Mb c:\windows\PCHEALTH\HELPCTR\***\
56.8 Mb c:\windows\RegisteredPackages\***\
22.4 Mb c:\windows\REPAIR\
24.9 Mb c:\windows\ServicePackFiles\i386\lang\
478.4 Mb c:\windows\ServicePackFiles\i386\
22.3 Mb c:\windows\ServicePackFiles\i386\sp2.cab
36.9 Mb c:\windows\SYSTEM32\CONFIG\***\
273.4 Mb c:\windows\SYSTEM32\DLLCACHE\
32.4 Mb c:\windows\SYSTEM32\DRIVERS\***\
37.9 Mb c:\windows\SYSTEM32\MUI\***\
24.3 Mb c:\windows\SYSTEM32\SPOOL\DRIVERS\W32X86\3\
33.1 Mb c:\windows\SYSTEM32\SPOOL\DRIVERS\W32X86\***\
26.2 Mb c:\windows\SYSTEM32\WBEM\***\
514.1 Mb c:\windows\SYSTEM32\***\
210.5 Mb c:\windows\***\
----------
2.7 Gb grand total, 17659 files in 614 directories
See the description of the -resolution
option for further information.
The most common use of the d command, however, is to list files
and directories, just like
Windows dir or Unix ls.
> d '*.html'
Directory of /home/chris/work/
505 19-Mar-2001 14:21:06 about.html
3 kb 9-Jun-2002 17:39:18 index.html
----------
3 kb total, 2 files
> d *.html
Directory of e:\work\
505 19-Mar-2001 14:21:06 about.html
3 kb 9-Jun-2002 17:39:18 index.html
----------
3 kb total, 2 files
> d *.htm*
The d command takes one or more filenames, with or without
wildcards, as parameter. If no filename is given, the default is to
list all files in the current directory.
The * and ? wildcards have their normal meanings in file names. Square brackets [xyz] can be used to specify sets of characters.
Under Linux, filenames that contain wildcard characters must be enclosed in single quotes, to prevent the shell from expanding the wildcards ("globbing").
> d '*.htm*'
The directory delimiter is backslash under Windows and forward slash under Linux. For filenames that are enclosed in single quotes, you can use forward slash under Windows as well.
> d 'work/*.htm*' -since=1-may -noheaderThe above command works under both Windows and Linux.
In directory paths, the special wildcard *** means "...and all its subdirectories".
| d ***\a.xyz | All files named a.xyz in the current directory, or any of its subdirectories. |
| d \***\b.xyz | All files named b.xyz in any directory on the disk. |
| d \***\old\c.xyz | All files named c.xyz in any directory named old. |
See Filenames
for
further information about how the filename is divided into parts, and
about the wildcard syntax.
You can specify multiple filenames on the command line, separated by
spaces. To specify a filename that contains
spaces or other special characters, you enclose it in quotes. This
works for filenames that contain
wildcards as well.
Command options can start with a dash (-), two dashes, (--), or, on Windows, a slash (/). There are no semantic differences between the three variants. The option names are usually English words. You can write them out in full or truncate them, normally to two characters, as long as they are unique.
Options can be negated by putting no before them, so -noheader is the opposite of -header.
> d -since=1-may -noheader
> d --since=1-may --noheader
> d /since=1-may /noheader
See Parameters and Options for more about the command line syntax.
> d *** -exclude=(.doc .txt) -before=today -min_size=2mb -hidden=also
> d '***' -exclude=\(.doc .txt\) -before=today -min_size=2mb -hidden=also
| -since [= datetime] | Select files that were created on or after a certain date/time. |
| -before [= datetime] | Select file that were created before a certain date/time. |
| -min_size [= size] | Specify a minimum file size in bytes, Mb, or some other unit |
| -max_size [= size] | Specify a maximum file size . |
|
-directories
[= only/also/not]
|
List directory files (only/also/not) . Default is also. |
| -hidden [= only/also/not] | List hidden files (only/also/not). Default is not. |
| -nodefault | Do not add any default wildcards or other filename parts to
the filename. |
| -exclude [= filespec] | Exclude files that match the file specification given as option value. If the option value is enclosed in parenthesis, it can contain a full file specification, including recursive file selection options. |
| -current_only | List only the current version of the files by default. This option can be overridden by the file specification and/or the -default option. The -current option is specific to the d directory command. |
These options control which files are selected. See File Selection Options for more information.
> d *** -totals -sort=(size descending)
> d '***' -totals -sort=\(size descending\)
| Print a grand total for all the files in all the directories. | |
| -totals | Just print the total number of bytes for each directory. |
| -resolution [= size] | Print directories and files that are bigger than a certain size. Directories that are smaller than the specified size will not be listed as entries of their own. Instead, the byte total will be added to the size of the parent directory. |
| -sort [= sort_order] | Sorts the files by name (default), extension, size, or date. |
| -files | List the full filenames only, without any information about file sizes or dates, and with no headers or footers. The output will be a list of file names that is suitable for use as input for other programs. |
| -header | Print a header for each new directory that has files in it, and a footer with totals. |
| -size [= bytesize_syntax] | Print the file sizes. |
| -date [= datetime_syntax] | Print the date and time when each file was created. |
| -name [= filename_syntax] | Specify how the file name should be printed (with or without full path, with or without extension, etc.). |
| -permissions | Shows the file access permissions for each file. |
These options control what output is produced, and how it is
formatted. See Directory -
Output
Options.
> d -output=mydir.lis
| Specifies an output file. If the option is not present,
output will be sent to standard output.
If the -output option is given without a filename, the default filename is a.tmp, in the current working directory. |
See File Version Numbers: Output Files for a
description of how the version numbers work for output files.
> d '*.log' -nowarning
| Print out a brief help text with a summary of each of the different options, and exit from the program. | |
| -version | Show the name and version number of the program, and exit.
This option must be written out in full, and cannot be abbreviated. |
| -verbose
-v -statistics -noverbose |
Specify the amount of informational messages. |
| -warning -nowarning -noerror |
Specify the level of error reporting. |