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
  • 4
  • 3
LVL 95

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 95

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...
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).


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 95

Expert Comment

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

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

Featured Post

Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

Join & Write a Comment

Suggested Solutions

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...
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now