We'd like to remind Forumites to please avoid political debate on the Forum... Read More »
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
Posts: 2,794 Forumite


in Techie Stuff
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.
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.
0
Comments
-
0
-
You could also do a screen dump (Print Screen) of the directories.0
-
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=true0 -
try
dir /s /a:d > output.txt
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/dir.mspx?mfr=true
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.0 -
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')
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.0 -
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/!!
> . !!!! ----> .0 -
Karen's directory printer
http://www.karenware.com/powertools/ptdirprn.asp0
This discussion has been closed.
Confirm your email address to Create Threads and Reply

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