[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2008-11-20
3
Medium Priority
?
2,028 Views
Last Modified: 2012-05-05
C:\Documents and Settings\msp064646\My Documents>cmd /c dir . /o-n /b > test.txt

what is /o-n
and
/b
?
0
Comment
Question by:mawingho
  • 2
3 Comments
 
LVL 21

Accepted Solution

by:
AmazingTech earned 1080 total points
ID: 23002126
for details type this in.
dir /?
/o-n   is reverse order filename
/b is basic information
0
 
LVL 16

Assisted Solution

by:t0t0
t0t0 earned 920 total points
ID: 23004270
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
 
LVL 21

Assisted Solution

by:AmazingTech
AmazingTech earned 1080 total points
ID: 23005678
No worries t0t0.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question