Skip to Main Content



File Management

Tips for managing digital files by the Iowa State University Library

Folder trees

Uses 

Similar to file lists, a folder tree can help you understand how folders are organized and named. Possible uses include:

  • Reviewing folder locations and names to determine if name conventions are being followed.
  • Determining redundant or confusing folder names and content. 
  • Creating an inventory or documentation for reporting purposes.

Shell command overview

You can use shell commands to generate folder trees. There are options for displaying the files within a folder as well. 

Before using shell commands, you should be familiar with viewing files in File Explorer (Windows) or Finder (Mac). If you are using a cloud-based storage application, such as Box, Google Drive, or Dropbox, you may need to install a free desktop application to access your files through File Explorer or Finder. Go to the application's website for details.

You also should be able to open a command-line shell at a certain directory. For instructions, see the Command line quick start page.

Folder tree commands


Folder tree quick reference

 

Display folder tree

Display folder tree with files

   

Terminal

tree -d tree    

PowerShell or Command Prompt

tree tree /F    

Instructions

Use these links to view instructions for the following shells. Also consult the Command line quick start page if needed.


Mac Terminal

Before using tree commands on a Mac, install Homebrew and then Homebrew tree package: brew install tree

  1. In Terminal, navigate to the top-level directory (folder) you want to display as a tree.
  2. On the command line, type or paste one of these commands:
  • tree -d to output the folder tree in the shell window
  • tree to include folders and files in the output

Note: Enter tree --help to see a list of other display options.

To output results in a TXT file (saved in the top-level directory), append a file name to the command: tree -d > tree.txt 


Windows Command Prompt or PowerShell

The tree command is preinstalled and has two modifiers (switches) that allow you to customize how the folder tree is outputted. You can also export a folder tree to a file.

  1. In Command Prompt or PowerShell, navigate to the top-level directory (folder) you want to display as a tree.
  2. On the command line, type or paste one of these commands:
  • tree to output the folder tree in the shell window
  • tree /F to display files in the tree as well as folders
  • tree /A to output in ASCII/text characters (can be useful for importing into another program)

Note: You can combine the base command tree with both modifiers: tree /F /A

To output results in a TXT file (saved in the top-level directory), append a file name to the command: tree /A > tree.txt 

Note: Text files output in a similar format regardless if the /A modifier is used, but using it may yield a cleaner result.

Contact information

Questions? Contact us!

Consultations are also available by request.

Megan O'Donnell, Research Data Services Lead

datashare@iastate.edu

Heather Campbell, Head of Metadata Services

metadata@iastate.edu

File Management by Heather Campbell and Megan O'Donnell is licensed under CC BY 4.0 Attribution