Use tree to generate a file directory tree for display

PHPz
Release: 2024-03-01 17:46:02
forward
1356 people have browsed it

tree is a command line tool that recursively lists the contents of a directory in a tree format, so that all directories, subdirectories and files are listed in a hierarchical manner, thus intuitively Shows the organization of files and folders.

The following is the installation and use method of tree under Windows and Linux systems

Installation and use of tree under Linux

  • Installing tree under Linux:
  • apt update && apt install tree
    Copy after login
  • The following are common ways of using the tree command.
  • # 显示指定路径下的目录树
    tree /d/temp
    # 限制最大的展示深度
    tree -L 3
    # 只显示目录不显示文件
    tree -d
    # 显示包括隐藏的文件和目录
    tree -a
    # 为每个文件打印完整路径前缀
    tree -f
    Copy after login
  • In addition, the directory tree can also be output to the specified file.
  • tree /f > tree.txt
    Copy after login

    Installation and use of tree under Windows

  • Download binaries in Tree for Windows.
  • Use tree to generate a file directory tree for display

  • Extract the downloaded file and find the tree.exe file in the bin folder. Move the file to your preferred software installation directory, such as C:ProgramFilestreetree.exe.
  • Open system properties and add the tree directory to the environment variable in the following order.
  • Use tree to generate a file directory tree for display

  • Find the folder where you need to create a new tree directory, open Git Bash in Terminal and enter the command. (For specific configuration, see Windows Terminal Usage and Configuration)
  • The usage of tree under Windows is consistent with Linux, so there is no need to go into details.
  • The above is the detailed content of Use tree to generate a file directory tree for display. For more information, please follow other related articles on the PHP Chinese website!

    Related labels:
    source:mryunwei.com
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template