We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

Creating a list of folders and subfolders

Options
VoucherMan
VoucherMan Posts: 2,794 Forumite
Part of the Furniture 1,000 Posts Name Dropper
Does anyone know of a (simple) way to do this?

I decided it's time for a tidy up of the hard drives so want to make a list (text file) of all the folders and subfolders on them.

There seem to be a few ways to make a list of the current directory, and I've also found using dir /s from the command prompt or within a .bat file to make a full list but this includes all the files as well so is a bit big to work with.

Comments

  • Mikebellows
    Mikebellows Posts: 236 Forumite
    Have a look here...

    http://www.computerhope.com/issues/ch000772.htm

    Hope this helps.
  • Mikebellows
    Mikebellows Posts: 236 Forumite
    You could also do a screen dump (Print Screen) of the directories.
  • tronator
    tronator Posts: 2,859 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    VoucherMan wrote: »
    Does anyone know of a (simple) way to do this?

    I decided it's time for a tidy up of the hard drives so want to make a list (text file) of all the folders and subfolders on them.

    There seem to be a few ways to make a list of the current directory, and I've also found using dir /s from the command prompt or within a .bat file to make a full list but this includes all the files as well so is a bit big to work with.

    try

    dir /s /a:d > output.txt

    http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/dir.mspx?mfr=true
  • VoucherMan
    VoucherMan Posts: 2,794 Forumite
    Part of the Furniture 1,000 Posts Name Dropper
    tronator wrote: »

    Thanks everyone.

    This one does the trick.

    Then I can import it to Excel & filter out the unwanted stuff to tidy it up. It was a bit too big to work with with all the files as well as folders.



    As you've succeeded where I failed with Google - What I'd also like to do is list all the folders & subfolders as before also listing the first file within each folder. (I'm expecting 'forget it - can't be done')

    For the smaller drive I could use dir /s without the attributes then just filter out all but the first files in each. But as mentioned earlier the larger drive has too many files to do in one go. I could make 2 or 3 smaller lists but it would be much better if there was a way to do it all in one go.
  • Jivesinger
    Jivesinger Posts: 1,221 Forumite
    Ninth Anniversary Combo Breaker
    VoucherMan wrote: »
    As you've succeeded where I failed with Google - What I'd also like to do is list all the folders & subfolders as before also listing the first file within each folder. (I'm expecting 'forget it - can't be done')
    You can do this sort of thing with Excel formulae. As you suggest you can use dir /s, but I'll suggest adding a /a-d to take the folders out.

    dir /s /a-d >somefile.txt.

    Then open somefile.txt in Excel (don't let Excel try to split anything into columns, we want everything in Column A).

    What I've done then is add the following formulae in some of the cells in row 4 (which on my version of Windows is where the first directory folder starts)
    Cell B4: =SEARCH("Directory of",A4)
    Cell C4: =SEARCH("file(s)",A4)
    Cell D4: =MID(A4,37,999)
    Cell E4: =IF(NOT(ISERROR(C4)),"",IF(NOT(ISERROR(B4)),MID(A4,B4+13,999),E3))
    Cell F4: =IF(ISERROR(B2),"",IF(B2=2,D4,""))
    

    Then
    * copy these formulae all the way down to the last row in the DIR output
    * select the whole spreadsheet, hit Ctrl C to copy, and then right-click to use "Paste Special" to paste the cells over themselves as values
    * Then sort all the data rows by column F, then delete all the rows where Column F is blank.

    You should end up with column E showing the folder name and F showing the first file. It won't show empty folders mind you.
  • closed
    closed Posts: 10,886 Forumite
    edited 4 May 2013 at 12:23AM
    tree /F (from the cmd window) add on > c:treelist.txt to redirect to a file.

    Not what you asked for, but these are useful for seeing what's there, and how big, and cleaning up. Wading through potentially 100's of thousands of files on a spreadsheet seems a complicated way to do it.

    http://www.snapfiles.com/get/wiztree.html

    http://www.voidtools.com/

    http://www.filehippo.com/download_ccleaner/
    !!
    > . !!!! ----> .
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 350.8K Banking & Borrowing
  • 253K Reduce Debt & Boost Income
  • 453.5K Spending & Discounts
  • 243.8K Work, Benefits & Business
  • 598.6K Mortgages, Homes & Bills
  • 176.8K Life & Family
  • 257.1K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.