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
?
mawinghoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AmazingTechCommented:
for details type this in.
dir /?
/o-n   is reverse order filename
/b is basic information
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.