How to export the directory tree of a folder in Windows

Did you ever need to export the entire directory tree from a particular folder? Did you need to get a text or Excel document that lists all the files and folders inside a specific folder from your computer into a hierarchical structure? We had this need when we were trying to create a document that was supposed to be a summary of all the Word documents and Excel spreadsheets we had stored inside a folder. It was at that time that we asked ourselves a couple of questions. Can you automatically export a folder's structure to Excel? Is there a DOS tree command that outputs to a file? Can you print a directory tree into an Excel sheet or as a text file? If you want to find out how to export a folder tree, read on:

Contents

  1. 1. Export a folder's structure to a text file, using the "Tree" command in Command Prompt
  2. 2. Export a folder's structure to an Excel or CSV file, using our FolderTree tool (based on PowerShell)
  3. Why did you want to know how to export the directory tree of a folder?

NOTE: We have two methods that you can use to export a folder's tree. The first one is based on using the Command Prompt and generates the directory tree as a text file. The second relies on an executable file that we created with PowerShell and outputs the folder tree as an Excel file and as a CSV file.

1. Export a folder's structure to a text file, using the "Tree" command in Command Prompt

The first thing is to open File Explorer and navigate to the folder for which you want to export the directory tree. In our case, that would be "D:Games."

How to export the directory tree of a folder in Windows

Using File Explorer to get to the folder

Type cmd in File Explorer's address bar and press Enter to open the Command Prompt directly at the folder you are interested in.

How to export the directory tree of a folder in Windows

Opening Command Prompt at the location of the folder

A Command Prompt instance is opened, pointing to your folder. In our case, the Command Prompt was opened using the "D:Games" folder. To export the folder's structure, run this command: tree /a /f > output.doc.

How to export the directory tree of a folder in Windows

Running the tree command to get the folder structure

TIP: If you don't want the directory tree to include files (in other words, make the tree include only folders), skip the /f parameter from the command (tree /a > output.doc).

Output.doc is the document file in which the entire directory tree is going to be saved. You can use any name for it, and you can specify any file type, as long as it has a text file type. We prefer using Microsoft Word .doc files, but you could use any other text file. For instance, you can choose to output the directory tree to a simple .txt file that's editable with Notepad. Depending on how many folders and files are stored inside your folder, running this command can take a moment or two.

How to export the directory tree of a folder in Windows

The tree command can take a while if the folder on which it's run has many items

Now you can close the Command Prompt, as you don't need it anymore. Go back to File Explorer and navigate to the folder for which you wanted to export the directory tree. Inside, you should find the new text file with the name you specified in the tree command. In our case, this file is called output.doc.

How to export the directory tree of a folder in Windows

The output text file with the directory tree

Open the output file and the entire directory tree is listed inside. It looks good, doesn't it?

How to export the directory tree of a folder in Windows

The folder tree inside a document file

NOTE: If you want to export the directory tree of a folder that contains system files or folders, you must launch Command Prompt with administrative rights and then navigate to your folder from the Command Prompt itself.

2. Export a folder's structure to an Excel or CSV file, using our FolderTree tool (based on PowerShell)

Another easy way to export the structure of a folder in Windows 10 is to use a tool that we created for you, called FolderTree. Download it using this link or the one at the end of this section. Save it somewhere on your Windows 10 PC. Then, move or copy it to the folder for which you want to get the tree structure. In that folder, double-click or double-tap on the FolderTree executable.

How to export the directory tree of a folder in Windows

Place FolderTree in the folder for which you want the directory tree

When you launch FolderTree for the first time, the SmartScreen filter warns you that it is an unrecognized app. That's because there are not that many people downloading and using it. Take our word that it's safe and does not harm your PC. It is nothing more than a PowerShell script inside an executable file and a simple user interface. To be able to use this tool, click or tap on "More info" and then choose to "Run anyway."

How to export the directory tree of a folder in Windows

Choosing to run FolderTree in the SmartScreen dialog

When FolderTree opens, you should see a small window like the one below. To get the directory tree of the current folder, push the "Get folder tree to Excel" button.

How to export the directory tree of a folder in Windows

Get Folder Tree to Excel

The tool then outputs two files: FolderTree.xlsx and FolderTree.csv. Both contain the tree list of folders and files inside your current directory.

How to export the directory tree of a folder in Windows

FolderTree outputs the directory tree in Excel and inside a CSV file

Furthermore, both files should have two columns: Directory and Name. Directory tells you the folder, and Name tells you the files in that folder.

How to export the directory tree of a folder in Windows

The directory tree exported in Excel

Now you can go ahead and edit the Excel or CSV file with your folder tree as you want. If you encounter any issues with our tool, let us know in the comments section below.

Download: FolderTree

Why did you want to know how to export the directory tree of a folder?

Exporting the entire directory tree structure to a text file is quickly done in Windows. All you need is the Command Prompt and the right command. Exporting a directory tree to Excel is also easy if you use our FolderTree tool. Before closing this article, tell us why you wanted to create a file folder tree? Was it because you wanted to make a list of your music files? Was it for a work-related task? Comment below and let's discuss.

Sign up and earn $1000 a day ⋙

How To Access An Android Phone With A Broken Screen

How To Access An Android Phone With A Broken Screen

Dealing with a broken screen on your Android phone is a hassle. Although phone screens are pretty tough, one nasty drop can shatter them completely. Given that most people have a lot of irreplaceable content on their phones, it is

Find out how to find friends and family using online services

Find out how to find friends and family using online services

In today's world, where information is more accessible than ever before, finding long-lost friends or relatives has become much easier. Online services for finding people provide convenient and effective tools that allow you to restore lost connections.

IObit Uninstaller 13 - One Click to Uninstall All Unwanted Programs

IObit Uninstaller 13 - One Click to Uninstall  All Unwanted Programs

In the busy software utilities industry, the available uninstallation tools are often overshadowed by more glamorous alternatives. Nonetheless, an excellent way of removing programs on a PC is vital for optimal system performance and the elimination of unwanted applications.

Instructions for creating Moon phase trend

Instructions for creating Moon phase trend

Instructions for creating a Moon phase trend. The Moon trend is extremely popular on TikTok, creating an unprecedented fever. Through Moon phase will help you know the date

How to edit videos posted on YouTube without losing views

How to edit videos posted on YouTube without losing views

How to edit videos posted on YouTube without losing views, You forgot to blur sensitive content in videos posted on YouTube. Don't worry, here's how to adjust it

How to enable dark mode on TikTok

How to enable dark mode on TikTok

How to turn on dark mode on TikTok, How to turn on dark mode on TikTok is not difficult. The article will guide you in detail how to change the TikTok interface to black on Samsung

Shirt size chart - How to choose the most accurate shirt size

Shirt size chart - How to choose the most accurate shirt size

Shirt size chart - How to choose the most accurate shirt size, What is the shirt size chart? Shirt size means only the size and size of the shirt or pants. Shirt size varies according to direction

Instructions for drawing prizes to receive Lucky Money on ZaloPay

Instructions for drawing prizes to receive Lucky Money on ZaloPay

Instructions for drawing prizes to receive Lucky Money on ZaloPay. Recently, Zalo has launched the program "Amazing lucky money, Happy Spring Luck" taking place from January 29, 2021 to

How to view and recover Microsoft Outlook password

How to view and recover Microsoft Outlook password

How to view and recover Microsoft Outlook password, How to view Outlook password on computer is not difficult. This article will guide you how to view and recover Outlook password

Instructions for creating and searching for draft posts on Facebook

Instructions for creating and searching for draft posts on Facebook

Instructions for creating and searching for draft articles on Facebook. Currently, we can save articles that we have created but have not yet posted on Facebook. Here, WebTech360 invites

How to set up LibreOffice Writer to work like Microsoft Word

How to set up LibreOffice Writer to work like Microsoft Word

How to set up LibreOffice Writer to work like Microsoft Word, If you're planning to switch from Microsoft Word to LibreOffice Writer but want a similar experience

Instructions for turning off saving videos on TikTok are extremely simple

Instructions for turning off saving videos on TikTok are extremely simple

Instructions for turning off saving videos on TikTok are extremely simple, to help people block others from downloading and saving their videos simply and easily. So today, WebTech360

Instructions for creating genealogical and organizational charts on Google Sheets

Instructions for creating genealogical and organizational charts on Google Sheets

Instructions for creating genealogical charts and organizing them on Google Sheets. Google Sheets is an online office application that helps us easily edit online spreadsheets,

How to import and manage multiple email accounts in Gmail

How to import and manage multiple email accounts in Gmail

How to import and manage multiple email accounts in Gmail, Want to manage all emails in Gmail? Let's learn how to manage and add multiple accounts with WebTech360

Instructions for using Photoshop filters for beginners

Instructions for using Photoshop filters for beginners

Instructions for using Photoshop filters for beginners, Each filter in Photoshop has its own algorithm and uses. Below are instructions for using the internal filter

How to create automatic clicks on Macrorify

How to create automatic clicks on Macrorify

How to create automatic clicks on Macrorify, Macrorify helps you create automatic click tasks and detect images. In this article, let's find out how with WebTech360

Instructions for logging out of Instagram account remotely

Instructions for logging out of Instagram account remotely

Instructions for remotely logging out of your Instagram account. If you don't know how to remotely log out of your Instagram account, today WebTech360 would like to introduce

Instructions for remotely logging out of Tik Tok account

Instructions for remotely logging out of Tik Tok account

Instructions for remotely logging out of Tik Tok account. To help people quickly log out of Tik Tok accounts from other devices, today WebTech360

Instructions for blurring photos on B612

Instructions for blurring photos on B612

Instructions for blurring photos on B612. Recently, the B612 application has updated the image blur effect. Next, WebTech360 will introduce the article Instructions for blurring photos

How to fix the error of printing blank pages in Microsoft Excel

How to fix the error of printing blank pages in Microsoft Excel

How to fix the error of printing blank pages in Microsoft Excel. Why do some Excel documents not display data or contain blank pages when printed? Below are the reasons