Need to export list of all folders and sub-folders

Posted on 2013-11-11
Last Modified: 2013-12-30
What are my options to create an export file that shows all sub-folders under a top level folder?
Question by:iNetSystem
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 96

Accepted Solution

Lee W, MVP earned 500 total points
ID: 39640589
If I understand what you're asking for, open a command prompt and type:

dir /ad /b /s x:\ > file.txt


X:\ is the root of the drive you want (C:, D:, etc)
file.txt is the name of the text file you want to use to save this export.

Author Comment

ID: 39640592
Hi -

Let's assume the D volume on a server has a folder named IT.  I would like to export to a text file but a CSV is preferred all folders and sub-folders under the IT folder.  I don't care to list any files, I only need to see the folder structure.
LVL 96

Expert Comment

by:Lee W, MVP
ID: 39640604
Did you try the command I suggested?  What part are you having difficulty with... perhaps I could clarify...
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.


Author Comment

ID: 39640618
I did try that but it is not getting below the first level of sub-folders.  for each sub folder there can be several levels below that.

Author Comment

ID: 39640624
Actually it seems to have worked.

Author Comment

ID: 39640629
the order of the folders seems to be random - it's not everything I wanted but will work.

LVL 96

Expert Comment

by:Lee W, MVP
ID: 39640673
Change the order - add /o

dir /ad /b /s /o x:\ > file.txt

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
Suggested Courses

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question