Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Directory List

03 Sep 2009   #11
Dwarf

Windows 8.1 Pro RTM x64
 
 

You only need quote-marks around the filename(s) (including the path(s)) if either or both contain spaces. It makes no difference whether you include them or not, but you MUST include them if there is a space anywhere in the relevant filename or path.

Examples (note that Src is the source drive and Dst is the destination drive).
Code:
DIR "Src:\data" /s > "Dst:\List.txt"
This format will ALWAYS work.
Code:
"Src:\data" /s > "Dst:\List.txt
This will NOT work (missing " - these need to be in pairs).
Code:
"Src:\data /s > Dst:\List.txt"
This will NOT work (" to be placed around filename(s) (including the path(s)) only).
Code:
"Src:\data" /s > Dst:\Data List.txt
This will NOT work (destination filename contains a space).
Code:
"Src:\data" /s > Dst:\Data List\List.txt
This will NOT work (destination path contains a space).


My System SpecsSystem Spec
.
03 Sep 2009   #12
chuckr

XP_Pro, W7_7201, W7RC.vhd, SciLinux5.3, Fedora12, Fedora9_2x, OpenSolaris_09-06
 
 

Quote   Quote: Originally Posted by Dwarf View Post
You only need quote-marks around the filename(s) (including the path(s)) if either or both contain spaces. It makes no difference whether you include them or not, but you MUST include them if there is a space anywhere in the relevant filename or path.
Thank you for the definitive examples.
Member 'huffman' should be well versed on this now...

As a side note:
I believe the "pipe" symbol is |
i.e. type list.txt | more
(in olden days)

whereas the > symbol indicates 'redirection'
i.e. not to console, but to a file.
(in olden days)

But, they may have changed the terminology for Vista/w7...
My System SpecsSystem Spec
03 Sep 2009   #13
Antman

 

Quote   Quote: Originally Posted by ChuckR View Post

The /h option is good too, if he wants to see hidden files...
/a:h to be exact
My System SpecsSystem Spec
.

03 Sep 2009   #14
Antman

 

Quote   Quote: Originally Posted by ChuckR View Post
I believe the "pipe" symbol is |
i.e. type list.txt | more
(in olden days)

whereas the > symbol indicates 'redirection'
i.e. not to console, but to a file.
(in olden days)
Right-o
My System SpecsSystem Spec
04 Sep 2009   #15
Kari

Microsoft Community Contributor Award Recipient

 

Quote   Quote: Originally Posted by ChuckR View Post
As a side note:
I believe the "pipe" symbol is |
i.e. type list.txt | more
(in olden days)

whereas the > symbol indicates 'redirection'
i.e. not to console, but to a file.
(in olden days)

But, they may have changed the terminology for Vista/w7...
Me too, I was using the wrong term. Sorry. In my earlier post I ment redirection when talking about pipe.

I stand corrected.

Kari
My System SpecsSystem Spec
04 Sep 2009   #16
chuckr

XP_Pro, W7_7201, W7RC.vhd, SciLinux5.3, Fedora12, Fedora9_2x, OpenSolaris_09-06
 
 

As another side note,

I prefer the list to show 'folders' first, then the 'filenames'.

Both sorted alphabetically, therefore I use options

/O:GN

To save typing it all the time, I use the "Set Environment Variable" command:

set dircmd=DIR /O:GN /P (where the /P option is 'page at a time', onscreen)

Then, when I type 'dir',
the output to the crt is folders first, followed by filenames, both sorted alpha, and a screenful at a time...
Looking like this:

(I don't really use the /system or /hidden options, since I always enable the
"Don't Hide nuthin", "Show System-files", "Show FileExtensions", etc. via Windows, so I can always see what's really there.)

Hope this helps...


Attached Images
Directory List-dir0.png 
My System SpecsSystem Spec
04 Sep 2009   #17
huffman

Windows 7 Pro
 
 

Thank you guys very much finally have two prompts that work:

DIR "E:\data\" /s > "C:\List.txt"

and

DIR E:\data\ /s > C:\List.txt
My System SpecsSystem Spec
04 Sep 2009   #18
Dwarf

Windows 8.1 Pro RTM x64
 
 

I'm pleased that you have solved your problem.

As for the prompts, I recommend the former one, with the quotes ("), as you can't go wrong with that.
My System SpecsSystem Spec
04 Sep 2009   #19
logicearth

Windows 10 Pro (x64)
 
 

[samp]tree X:\ /f/a > tree.txt[/samp]
Produces a much better looking display.
My System SpecsSystem Spec
16 Jan 2010   #20
mikemcm1956

Seven, Of Course!
 
 

My System SpecsSystem Spec
Reply

 Directory List




Thread Tools




Similar help and support threads
Thread Forum
Backup directory using dos.
Hi, I have tried. Various methods to fix my laptop and its not happening. All the tools to fix it are more than i can afford so will be doing a clean install. My question is, can anyone tell me how to back up the users folder to a USB, i have checked computer hope and everything i find is to back...
General Discussion
Cannot change directory (CD) to a directory with space in the name
Following the directions outlined in https://www.sevenforums.com/general-discussion/144154-change-directory-command-prompt.html including enabling command extensions outlined in https://www.sevenforums.com/general-discussion/41993-command-line.html does not permit the CD command to change the...
General Discussion
How to make a directory list contents as a menu
Hello everyone! I am here because I am wondering if Windows has such thing as the capability of listing a menu of the contents of a folder. For example, I am an ex-MacOS user and in the old days (pre-OSX) there was a program called FreePPP that had a menu item to which you could add...
General Discussion
What is this directory?
The following directory has zero files. What is it? C:\2f04dd45bebca7274eda34cc24490614 Thanks, Mark
General Discussion
List Files in Folder With Ignore List
Edit: Sorry I made the topic an forgot to change the title. Should be: "List Files in Folder With Ignore List" or something along those lines. I'm a game server admin. What I want to do is generate a text file which will be used when I launch the server. An example of the text file I want to...
General Discussion
Replace files in multiple directory, from a single directory
I have a 10 files that have all been categorised into about 40 folders. These files have been damaged. I have a backup of all these files, but they are not categorised and sit in a single directory. Does anyone know of an easy technique to batch replace the damaged files with the originals? ...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 22:11.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App