Windows 7 / Getting Started

Sorting Listings

By default, dir sorts files by name.You can list files in some other order by using the /o option, followed by one or more letters indicating which parts of the file information to use for sorting. Reference List previous, earlier in this tutorial, shows the whole list of sort options. Some of the most useful combinations are listed here:

Option 	Sorts
/o-s 	By size. Largest first
/odn 	By date. Oldest first, then by name
/o-dn 	By date. Newest first, then by name
/oen 	By type (extension), then by name

Listing Hidden Files

Normally, hidden files are omitted from dir listings. (What would be the point otherwise?) However, you can ask dir to list hidden files by adding /ah to the command line.The /a flag instructs dir to list files with specified attributes, and the h indicates that you want to see hidden files.

You can use the /a option to select files based on the other attributes listed in Reference List previous. For example, /as lists only system files, /a-s lists only files that are not marked as system files, and so on.

[Previous] [Contents] [Next]