Results 1 to 11 of 11
  1. #1
    New Lounger
    Join Date
    May 2015
    Location
    Alfreton
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Directory listings

    Any ideas please on how i can get a list of files in Windows Explorer within a folder and then easily copy and paste the list into say Excel to sort them. At present if I need to do this I can't copy the names of the files it cooies the files themselves

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Shepherd,

    Welcome to the Lounge as a new poster!

    The easiest way is to open a command prompt then use this command:

    dir [/s] d:\path\*.* > filename.txt

    where:
    d: = drive letter, e.g. C:\
    path = folder path to the desired directory, e.g. \Users\Documents\Excel\
    *.* = file filter, e.g. *.* = all files, *.xls* = only Excel files
    filename = the name of the file that will get the listing.
    /s = also list all subdirectories of the selected folder.

    This file can then be inported into excel.

    Of course, I would be remiss if I didn't mention that this could also be done with a little VBA code in Excel!

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. The Following User Says Thank You to RetiredGeek For This Useful Post:

    shepherd1 (2015-05-22)

  4. #3
    New Lounger
    Join Date
    May 2015
    Location
    Alfreton
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for coming out of retirement, RetiredGeek

    Thats really helpful but I can't believe you have to the command prompt to do this

    I've modified what you've done slightly in that if I give the O/P file a .csv extension I can double click it to open it in Excel

  5. #4
    Silver Lounger RolandJS's Avatar
    Join Date
    Dec 2009
    Location
    Austin metro area TX USA
    Posts
    1,735
    Thanks
    95
    Thanked 128 Times in 125 Posts
    Creating a batchfile, making a shortcut to it, works -- it doesn't need user to open a command box; the batchfile will open a command box for the user.
    Addendum: Seeing PaulT's later batchfile, realized I need a %1 for the d:\path portion, have to utilize batchfile within an open dos-box in order to funnel into filenames.txt
    Last edited by RolandJS; 2015-05-23 at 15:18.
    "Take care of thy backups and thy restores shall take care of thee." Ben Franklin revisited.
    http://collegecafe.fr.yuku.com/forum...-Technologies/

  6. #5
    4 Star Lounger
    Join Date
    Jan 2010
    Location
    Fort McMurray, Alberta, Canada
    Posts
    565
    Thanks
    51
    Thanked 68 Times in 66 Posts
    This is one of those tasks that has never quite been overtaken by the GUI. The DOS method works well enough.

    One thing, for this purpose the command switch /B is often used. It gets rid of a lot of extra detail that isn't usually helpful. Thus the command pattern becomes:

    dir /s /b d:\path\*.* > filename.txt

  7. #6
    Silver Lounger
    Join Date
    Mar 2014
    Location
    Forever West
    Posts
    2,078
    Thanks
    0
    Thanked 259 Times in 248 Posts
    An alternative is Karen's Directory Printer [Karenware], has a lot of choices that can be selected/deselected. It works on Win7 and Win10TP, can send to printer or save as a .txt file.
    http://www.majorgeeks.com/files/deta...y_printer.html

  8. The Following User Says Thank You to Berton For This Useful Post:

    lumpy95 (2015-05-22)

  9. #7
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,199
    Thanks
    48
    Thanked 986 Times in 916 Posts
    dir /s /b d:\path\*.* > filename.csv & start "" filename.csv

    cheers, Paul

  10. The Following User Says Thank You to Paul T For This Useful Post:

    access-mdb (2015-05-23)

  11. #8
    WS Lounge VIP access-mdb's Avatar
    Join Date
    Dec 2009
    Location
    Oxfordshire, UK
    Posts
    1,726
    Thanks
    147
    Thanked 156 Times in 149 Posts
    Just what I wanted Paul, thanks

  12. #9
    Silver Lounger RolandJS's Avatar
    Join Date
    Dec 2009
    Location
    Austin metro area TX USA
    Posts
    1,735
    Thanks
    95
    Thanked 128 Times in 125 Posts
    Couldn't get csv loading properly with LibreOffice, so I converted batchfile from csv to txt
    "Take care of thy backups and thy restores shall take care of thee." Ben Franklin revisited.
    http://collegecafe.fr.yuku.com/forum...-Technologies/

  13. #10
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,199
    Thanks
    48
    Thanked 986 Times in 916 Posts
    LibreOffice reads my CSV files. What problems did you have?

    cheers, Paul

  14. #11
    5 Star Lounger Lugh's Avatar
    Join Date
    Jun 2010
    Location
    Indy
    Posts
    627
    Thanks
    168
    Thanked 77 Times in 68 Posts
    Quote Originally Posted by shepherd1 View Post
    I can't believe you have to the command prompt to do this
    Windows usually includes the basics for casual users, anything more is for the community to develop.

    There are lots of free and paid replacements for Windows Explorer out there, which may do what you want--I know the one I use does. A search will land you in File Manager heaven.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •