• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2064
  • Last Modified:

cmd /c dir . /o-n /b > test.txt

C:\Documents and Settings\msp064646\My Documents>cmd /c dir . /o-n /b > test.txt

what is /o-n
and
/b
?
0
mawingho
Asked:
mawingho
  • 2
3 Solutions
 
AmazingTechCommented:
for details type this in.
dir /?
/o-n   is reverse order filename
/b is basic information
0
 
t0t0Commented:
Apologies for stepping on your toes AmazingTech....

The DIR command's /O switch lists files in sorted order.

DIR /O     Folders are grouped together at the top of the list in alphabetical order followed by files grouped together in alphabetical order.

DIR /O:N     (It is good practice to include the colon although it is optional in XP) Lists folders and files in alphabetical order. Folders and files are NOT grouped together.

DIR /O:-N     Lists folders and files in reverse alphabetical order. Folders and files are NOT grouped together.

DIR /B     Lists folders and files in bare format (no heading information nor summary). In this case, you would not be able to distinguish which are folders and which are files. (The absence of file-extensions in the list may provide a clue as to whether an item is a folder or a file however, this cannot be guaranteed as it is possible to name folders with a '.' (dot) - extension).

DIR /O-N /B     Is the same as DIR /O:-N /B (it's formal form). Lists folders and files alphabetically in bare format. Folders and files arte NOT grouped together.

NOTE: None of the above options will list hidden and/or system folders nor hidden and/or system files.


If you intend to use the /B switch, it makes sense to also use the /A switch to distinguish between files and folders.

DIR /A     (On it's own) list ALL files and ALL folders regardless of their attributes including hidden and system files and folders.

DIR /A:D     Lists ONLY folders (formally known as 'Directories' hence the 'D') including hidden and system folders whereas,

DIR /A:-D     Lists ONLY files (ie, excluding folders) including hidden and system files.

Therefore,

DIR /O:N /B /A:-D     Lists ALL files alphabetically in bare format (including hidden and system files) whereas,

DIR /O:N /B /A:D     Lists ALL folders alphabetically in bare format (including hidden and system folders).


Finally, if you do NOT want to list hidden and system files and folders then you can combine the /A switch with the '-H' and '-S' attribute such as,

DIR /O:N /B /A:-D-H     Lists all files alphabetically in bare format excluding hidden files

DIR /O:N /B /A:-D-S     Lists all files alphabetically in bare format excluding system files

DIR /O:N /B /A:-D-H-S     Lists all files alphabetically in bare format excluding hidden and system files

For further options, type 'HELP DIR' in a DOS box.
0
 
AmazingTechCommented:
No worries t0t0.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now