Henry
发布于 2025-10-27 / 6 阅读
0
0

tree - 忽略指定目录

背景简介

在使用 tree 指令显示文件夹结构时,忽略指定目录。

前置信息

  1. tree 已安装

详细信息

  • 示例文件目录
.
├── alembic
│   ├── env.py
│   ├── __pycache__
│   │   └── env.cpython-311.pyc
│   ├── README
│   ├── script.py.mako
│   └── versions
│       ├── ebbc6e3a391e_create_user_basic_info_table.py
│       └── __pycache__
│           └── ebbc6e3a391e_create_user_basic_info_table.cpython-311.pyc
├── alembic.ini
├── app
│   ├── api
│   │   └── v1
│   │       ├── health.py
│   │       └── __pycache__
│   │           └── health.cpython-311.pyc
│   ├── core
│   │   ├── config.py
│   │   ├── database.py
│   │   ├── __init__.py
│   │   └── __pycache__
│   │       ├── config.cpython-311.pyc
│   │       ├── database.cpython-311.pyc
│   │       └── __init__.cpython-311.pyc
│   ├── __init__.py
│   ├── main.py
│   ├── models
│   │   ├── __init__.py
│   │   ├── __pycache__
│   │   │   ├── __init__.cpython-311.pyc
│   │   │   └── user_basic_info.cpython-311.pyc
│   │   └── user_basic_info.py
│   └── __pycache__
│       ├── __init__.cpython-311.pyc
│       └── main.cpython-311.pyc
├── ci
│   └── backend-deploy.sh
├── docker-compose.yml
├── Dockerfile
├── pytest.ini
├── README.md
├── requirements-dev.txt
├── requirements.txt
└── tests
    ├── __pycache__
    │   └── test_health.cpython-311-pytest-8.3.3.pyc
    └── test_health.py

17 directories, 32 files
  • 使用指令: tree -I “目录名|文件名”
tree -I "__pycache__|__init__.py"
.
├── alembic
│   ├── env.py
│   ├── README
│   ├── script.py.mako
│   └── versions
│       └── ebbc6e3a391e_create_user_basic_info_table.py
├── alembic.ini
├── app
│   ├── api
│   │   └── v1
│   │       └── health.py
│   ├── core
│   │   ├── config.py
│   │   └── database.py
│   ├── main.py
│   └── models
│       └── user_basic_info.py
├── ci
│   └── backend-deploy.sh
├── docker-compose.yml
├── Dockerfile
├── pytest.ini
├── README.md
├── requirements-dev.txt
├── requirements.txt
└── tests
    └── test_health.py

以上便是本文的全部内容,感谢您的阅读,如遇到任何问题,欢迎在评论区留言讨论。



评论