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 pin comments on TikTok

How to pin comments on TikTok

How to pin comments on TikTok, TikTok allows users to pin comments easily. Here's how to pin comments on TikTok videos.

Instructions for Organizing a Q&A session on Facebook

Instructions for Organizing a Q&A session on Facebook

Instructions for Organizing a Q&A session on Facebook, Recently, Facebook has launched the feature to create a Q&A session, when you post a question for everyone to answer.

Instructions for installing and recording videos with Likee

Instructions for installing and recording videos with Likee

Instructions for installing and recording videos with Likee, Likee is an application that supports extremely beautiful and impressive video recording, and is loved by many young people today. The following,

How to export the list of meeting participants in Zoom

How to export the list of meeting participants in Zoom

How to export the list of meeting participants in Zoom, How to take attendance on Zoom is not difficult, it even allows you to export the list of students participating in the class.

How to change font on Xiaomi

How to change font on Xiaomi

How to change font on Xiaomi, Want to create a new image for Xiaomi device? Just follow the instructions below to change the font style and size above

Instructions for creating a mirror image effect on Picsart

Instructions for creating a mirror image effect on Picsart

Instructions for creating a mirror image effect on Picsart, Picsart is an application where users only need to perform a few simple steps to transform the photo.

How to add new fonts to Microsoft Word

How to add new fonts to Microsoft Word

How to add new fonts to Microsoft Word, Can't find the font you want to use for documents in Microsoft Word? Don't worry, you can install new fonts for Word according to these steps

How to turn off the computer screen and still keep the computer running

How to turn off the computer screen and still keep the computer running

How to turn off the computer screen and still have the computer running, How to turn off the PC screen and still have the computer running on Win 10/11? Very simple. Here's how to turn off the computer screen

How to fix facebook error logging in 3/2024

How to fix facebook error logging in 3/2024

To fix the “An unexpected error occurred” issue when logging in to Facebook, you can try the following steps

Cant access Facebook, Messenger and Instagram, how to fix it immediately

Cant access Facebook, Messenger and Instagram, how to fix it immediately

Users reported that their Facebook, Messenger and Instagram accounts were suddenly logged out and could not be accessed again, both on the app and web version.

Instructions on how to take photos on Tiktok are extremely simple

Instructions on how to take photos on Tiktok are extremely simple

Instructions on how to take photos on Tiktok are extremely simple. Tiktok is a famous application for recording and creating short videos on social networks. However, this application also

How to find and get Instagram links

How to find and get Instagram links

How to find and get Instagram links, Instagram is one of the most popular and easy-to-use social networking platforms today. However, because it is designed specifically for mobile,

Instructions for locking the mouse cursor when playing games on BlueStacks

Instructions for locking the mouse cursor when playing games on BlueStacks

Instructions for locking the mouse cursor when playing games on BlueStacks, Instructions for turning on/off the mouse cursor lock feature when playing games in the BlueStacks App Player emulator.

Instructions for installing and using Faceapp using an emulator on PC

Instructions for installing and using Faceapp using an emulator on PC

Instructions for installing and using Faceapp using an emulator on PC, Simple and easy instructions on how to install and use the Faceapp face editing app using an emulator on PC

Instructions for creating a cover photo group on Facebook

Instructions for creating a cover photo group on Facebook

Instructions for creating a cover photo group on Facebook, Creating a cover photo group is a feature that helps users set Facebook cover photos with many different images (maximum of 6 photos).

Mastering Technical Analysis with the Stochastic Indicator on Bubinga

Mastering Technical Analysis with the Stochastic Indicator on Bubinga

Learn how to effectively use the Stochastic Indicator for technical analysis on Bubinga. Explore advanced techniques to enhance your trading strategies

Instructions for adding angel wings to photos using PicsArt

Instructions for adding angel wings to photos using PicsArt

Instructions for adding angel wings to photos using PicsArt, PicsArt is a photo editing application used by many people today. Today WebTech360 will introduce the article

How to turn off the Just accessed notification on Zalo

How to turn off the Just accessed notification on Zalo

How to turn off the Just accessed notification on Zalo. This article WebTech360 will guide you to turn off the Just accessed notification under your Zalo chat name.

Instructions for blocking and unblocking accounts on TikTok

Instructions for blocking and unblocking accounts on TikTok

Instructions for blocking and unblocking accounts on TikTok. Similar to other social networking applications, TikTok also allows users to block someone's account

How to write a long status with a colorful background on Facebook

How to write a long status with a colorful background on Facebook

How to write a long status with a colorful background on Facebook, Today, WebTech360 will introduce some steps to post a long status with a colorful background on Facebook,