What happened if the files of same size exists? Then it sorts based on the name of the file. We can use DIR command with the switch “/os” to list the files and folders and sort them by size. For example, to sort the list by name in descending order the command looks like below: C:\> dir /o-n List the files and sort them based on their size How to change this sort order? You need to prefix the symbol “-” before the parameters to reverse the sort order. List the files by Nameīy default DIR command displays the files or folders by sort order in ascending order by name of the files or folders. Through this switch it allows below parameters to control the sorting. Here we discuss it through this Article.ĭIR command provides the switch “ /O” to enable the sorting.
This command provides parameters to allow us to control the sort order. DIR command, by default displays the files and folders in sorted order by their name.