Wednesday, April 11, 2007

Windows : Getting a file list

Often need to put a list of files into a Word document or some such.

One way is to activate the command prompt (DOS box), navigate to the required directory and type:

dir /ON /B > dir.txt

The /ON option lists the files in alphabetic order. Further options are:

/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date/time (oldest first)
G Group directories first - Prefix to reverse order

The /B option uses a bare format (i.e. no heading information or summary).

The pipe option (>) sends the results to a file called dir.txt in the current directory.

From here, it can be cut & pasted into the Word document.

BTW, if you ever need to get information about a DOS command, type:

help "command"

e.g. help dir


No comments: