Windows 7 Forums


Windows 7: Directory List

02 Sep 2009   #1

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


Last edited by Dwarf; 04 Sep 2009 at 02:33 PM..
My System SpecsSystem Spec

02 Sep 2009   #2

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

Windows 7 Ultimate x64 + x86 + Windows 8 x64
Newport, South Wales, UK
 
 

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

Windows 7 x64 Ultimate
A Finnish immigrant in Leipzig, Germany
 
 

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

Windows 7 x64 (SP1)
 
 

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

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

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?

Last edited by darkassain; 03 Sep 2009 at 04:55 AM..
My System SpecsSystem Spec
03 Sep 2009   #7

Windows 7 x64 Ultimate
A Finnish immigrant in Leipzig, Germany
 
 

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

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

Windows 7 x64 Ultimate
A Finnish immigrant in Leipzig, Germany
 
 

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

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

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 problems?



Thread Tools



Similar help and support threads for: Directory List
Thread Forum
File directory: Many directory bear the same name after hd replacement Performance & Maintenance
Solved How to make a directory list contents as a menu General Discussion
What is this directory? General Discussion
List Files in Folder With Ignore List General Discussion
Replace files in multiple directory, from a single directory General Discussion


All times are GMT -5. The time now is 12:28 AM.


Seven Forums Android App Seven Forums IOS App Follow us on Facebook

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
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32