Directory List

Page 1 of 3 123 LastLast

  1. Posts : 710
    Windows 7 Pro
       #1

    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 14:33.
      My Computer


  2. Posts : 28,845
    Win 8 Release candidate 8400
       #2

    huffman said:
    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 Computer


  3. Posts : 31,249
    Windows 11 Pro x64 [Latest Release and Release Preview]
       #3

    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 Computers


  4. Posts : 17,545
    Windows 10 Pro x64 EN-GB
       #4

    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 Computer


  5. Posts : 5,642
    Windows 10 Pro (x64)
       #5

    The commands are still the same as they were in XP.
      My Computer


  6. Posts : 2,899
    Windows 7 Ult x64(x2), HomePrem x32(x4), Server 08 (+VM), 08 R2 (VM) , SuSe 11.2 (VM), XP 32 (VM)
       #6

    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.
      My Computer


  7. Posts : 17,545
    Windows 10 Pro x64 EN-GB
       #7

    logicearth said:
    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 Computer


  8. Posts : 710
    Windows 7 Pro
    Thread Starter
       #8

    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 Computer


  9. Posts : 17,545
    Windows 10 Pro x64 EN-GB
       #9

    huffman said:
    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 Computer


  10. Posts : 1,112
    XP_Pro, W7_7201, W7RC.vhd, SciLinux5.3, Fedora12, Fedora9_2x, OpenSolaris_09-06
       #10

    Kari said:
    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 Computer


 
Page 1 of 3 123 LastLast

  Related Discussions
Our Sites
Site Links
About 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 13:03.
Find Us