?
Solved

Basic DOS command to show contents of a folder or sub-folder

Posted on 2013-05-17
12
Medium Priority
?
630 Views
Last Modified: 2013-05-30
Hello,

I'm trying to understand a few of the very most basic DOS commands. I found a list of Basic DOS Commands but I keep getting the response:

"...is not recognized as an internal or external command, operable program or batch file."

For example, I changed drives by typing "e:" which gave me:

    E:\>

Then,

    E:\>dir

displayed a list of the folders and files in E:, one of which is the standard Windows folder called "Libraries." Next, I wanted to display a similar list of the contents of the Libraries folder. However, that's where I got hung up. I tried each of the following but obviously I'm doing something wrong:

    E:\>libraries>dir
    E:\>\libraries>dir
    E:\>\libraries\>dir
    E:\>\libraries\dir
    E:\>libraries dir

If someone could straighten me out on this, I'd appreciate it.

Also, what is the general DOS input for displaying contents of any sub-folder, e.g. in which the directory is, say:

    E:\Libraries\My Documents\FolderName1\FolderName2

Thanks
0
Comment
Question by:Steve_Brady
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 17

Expert Comment

by:pjam
ID: 39176025
Dir /s
0
 
LVL 24

Expert Comment

by:aadih
ID: 39176026
"Libraries" is not a real folder. It is a "junction point".

Anyway the syntax for the DIR Command is:

http://www.computerhope.com/dirhlp.htm >
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39176042
The command needs to come first followed by the options.

E:\>dir libraries
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 26

Accepted Solution

by:
pony10us earned 2000 total points
ID: 39176048
1. Assuming that you see a folder named Libraries and assuming you remain in the root of E: but want to look at what is in E:\Libraries you could just enter:

dir libraries


2. Assuming you are in the root of E: and want to look at what is in e:\Libraries\My Documents\FolderName1\FolderName2

You should be at the prompt:  E:>
Type dir "Libraries\My Documents\FolderName1\FolderName2"

You need the quotes because there is a space in My Documents. Without the quotes the command would interpret the line as:

dir Libraries\My

and drop all the characters after the space.

3. If you want to look at what is on a different drive, for instance c:\users, and you are still at the root of the E: drive:

dir c:\users
0
 
LVL 3

Expert Comment

by:CheVive
ID: 39176061
pony10us gets it right.
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39176096
@CheVive

Thank you

For help with the DIR (and any other DOS command)  by simply typing the command followed by /?

ex:  DIR /?

will give you the syntax, some explanation and examples for the DIR command
0
 
LVL 24

Expert Comment

by:aadih
ID: 39176107
Posted a link with command syntax (as the EE page for some reason does (did) not allow posting the syntax).
0
 
LVL 30

Expert Comment

by:serialband
ID: 39176338
@pony10us

Actually, your number 2 should be:

Without the quotes you're trying to list 2 likely non-existent folders.  It doesn't drop the 2nd argument.

One is named
Libraries\My
Another is named
Documents\FolderName1\FolderName2

The spaces separate arguments.
You could do a dir on any number of separate folders or files (limited by the command buffer)
dir   E:\   F:\   "C:\My Documents"   "C:\Users\My Full Name With Spaces"
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39176355
@serialband

Thank you for pointing that out.  I haven't done multiples in a long time and forgot about that.  

Something else to keep in mind is the /s and /p switches.

/s will also perform the command on all sub folders of the one you tell it to start in.

/p will give pause between screens full of information allowing you time to see the results. Some folders contain so many files that it will scroll by very fast and may even be more than will fit in the buffer so you can't scroll back to see it all.
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 39182503
I use this to get a bare list of all the files on the drive (I use it for a quickly searchable index since the Windows index tries to do too much and is so slow).

dir C:\ /s /b > somefile.txt

The /b makes it so each file with the full path is on its own line.
0
 

Author Closing Comment

by:Steve_Brady
ID: 39207853
Thanks
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

800 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