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

02 Sep 2009   #1
huffman

Windows 7 Pro
 
 
Directory List

There was a command prompt in winXP that would create a txt file with a list of directories, sub-directories and files for any given path. The prompt looked like this:
DIR "I:\" /s > "C:\List.txt"

There was something similar in Vista but I never did get the format needed that would work. I know it looked somthing lke this:
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

There must be something like this in win 7, just wondering if anyone may know what it is.

I know that Karen has a free program that does close to what I want but the command prompt did exactly what I want.

Thanks


My System SpecsSystem Spec
.

02 Sep 2009   #2
zigzag3143

Win 8 Release candidate 8400
 
 

Quote   Quote: Originally Posted by huffman View Post
There was a command prompt in winXP that would create a txt file with a list of directories, sub-directories and files for any given path. The prompt looked like this:
DIR "I:\" /s > "C:\List.txt"

There was something similar in Vista but I never did get the format needed that would work. I know it looked somthing lke this:
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

There must be something like this in win 7, just wondering if anyone may know what it is.

I know that Karen has a free program that does close to what I want but the command prompt did exactly what I want.

Thanks

Maybe its not a funtion of the dir command but of the path variable. The above dir works and ouputs to a text file. what is it not doing that you want it to do?

Ken
My System SpecsSystem Spec
02 Sep 2009   #3
Barman58

Windows 10 Pro x64 x2 Windows 10 Enterprise x64, Ubuntu
 
 

Full syntax for the dir command is available with the dir /? entry

Code:
C:\Windows\system32>dir /?
Displays a list of files and subdirectories in a directory.

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
  [/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

  [drive:][path][filename]
              Specifies drive, directory, and/or files to list.

  /A          Displays files with specified attributes.
  attributes   D  Directories                R  Read-only files
               H  Hidden files               A  Files ready for archiving
               S  System files               I  Not content indexed files
               L  Reparse Points             -  Prefix meaning not
  /B          Uses bare format (no heading information or summary).
  /C          Display the thousand separator in file sizes.  This is the
              default.  Use /-C to disable display of separator.
  /D          Same as wide but files are list sorted by column.
  /L          Uses lowercase.
  /N          New long list format where filenames are on the far right.
  /O          List by files in sorted order.
  sortorder    N  By name (alphabetic)       S  By size (smallest first)
               E  By extension (alphabetic)  D  By date/time (oldest first)
               G  Group directories first    -  Prefix to reverse order
  /P          Pauses after each screenful of information.
  /Q          Display the owner of the file.
  /R          Display alternate data streams of the file.
  /S          Displays files in specified directory and all subdirectories.
  /T          Controls which time field displayed or used for sorting
  timefield   C  Creation
              A  Last Access
              W  Last Written
  /W          Uses wide list format.
  /X          This displays the short names generated for non-8dot3 file
              names.  The format is that of /N with the short name inserted
              before the long name. If no short name is present, blanks are
              displayed in its place.
  /4          Displays four-digit years

Switches may be preset in the DIRCMD environment variable.  Override
preset switches by prefixing any switch with - (hyphen)--for example, /-W.
as you say adding the pipe >file.txt will send the output to a file
My System SpecsSystem Spec
.


02 Sep 2009   #4
Kari

Microsoft Community Contributor Award Recipient

 

You have to use Command Promp as an administrator to do this in Windows 7.
  • Run Command Prompt as an Administrator
  • type dir /s > C:\Test.txt, this creates a text file Test.txt onto the root of drive C:
Kari
My System SpecsSystem Spec
02 Sep 2009   #5
logicearth

Windows 10 Pro (x64)
 
 

The commands are still the same as they were in XP.
My System SpecsSystem Spec
03 Sep 2009   #6
darkassain

Windows 7 Ult x64(x2), HomePrem x32(x4), Server 08 (+VM), 08 R2 (VM) , SuSe 11.2 (VM), XP 32 (VM)
 
 

still works...
and if you want to store in the root your of the C drive you need to run as admin....
what error are you getting?
My System SpecsSystem Spec
03 Sep 2009   #7
Kari

Microsoft Community Contributor Award Recipient

 

Quote   Quote: Originally Posted by logicearth View Post
The commands are still the same as they were in XP.
Yes, that's true, though in Windows 7 you have to use administrative rights to use some of the features, like the pipe.
My System SpecsSystem Spec
03 Sep 2009   #8
huffman

Windows 7 Pro
 
 

OK ran prompt command as administrator and the put in the following prompt:


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

This should have created a text file on Cdrive with the files in E:\data listed.

No List.txt was created on C drive unless it was hidden somewhere.

LOL driving me nuts
My System SpecsSystem Spec
03 Sep 2009   #9
Kari

Microsoft Community Contributor Award Recipient

 

Quote   Quote: Originally Posted by huffman View Post
OK ran prompt command as administrator and the put in the following prompt:


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

This should have created a text file on Cdrive with the files in E:\data listed.

No List.txt was created on C drive unless it was hidden somewhere.

LOL driving me nuts
Hope you didn't type your command exactly like this; there should be no quotation marks around the output file name. Also the quotation mark after E:\data\ should not be there.

No quotation marks! It works, 100% guaranteed.

Kari
My System SpecsSystem Spec
03 Sep 2009   #10
chuckr

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

Quote   Quote: Originally Posted by Kari View Post
Hope you didn't type your command exactly like this; there should be no quotation marks around the output file name. Also the quotation mark after E:\data\ should not be there.

No quotation marks! It works, 100% guaranteed.

Kari
Righto!

The real problem is the odd nbr of quote-marks.

Should be even, to complete the command-line 'parsing', if he's really into 'quote-marks'...

Chances are, that this isn't nec. either:

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

The /h option is good too, if he wants to see hidden files...
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 http://www.sevenforums.com/general-discussion/144154-change-directory-command-prompt.html including enabling command extensions outlined in http://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 10:15.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App