Need to export list of all folders and sub-folders

What are my options to create an export file that shows all sub-folders under a top level folder?
iNetSystemAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Lee W, MVPConnect With a Mentor Technology and Business Process AdvisorCommented:
If I understand what you're asking for, open a command prompt and type:

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

WHERE:

X:\ is the root of the drive you want (C:, D:, etc)
and
file.txt is the name of the text file you want to use to save this export.
0
 
iNetSystemAuthor Commented:
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.
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Did you try the command I suggested?  What part are you having difficulty with... perhaps I could clarify...
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
iNetSystemAuthor Commented:
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.
0
 
iNetSystemAuthor Commented:
Actually it seems to have worked.
0
 
iNetSystemAuthor Commented:
the order of the folders seems to be random - it's not everything I wanted but will work.

Thanks!
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Change the order - add /o

dir /ad /b /s /o x:\ > file.txt
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.