Skip to main content

增强版 tree 命令 - 跨平台目录树显示工具,类似 Linux 的 tree 命令

Project description

zhangtree

增强版 tree 命令 - 跨平台目录树显示工具,类似 Linux 的 tree 命令。此版本只显示名称,不显示任何图标。

功能特性

  • 🌳 跨平台支持(Windows、Linux、macOS)
  • 📁 显示目录树结构
  • 🔍 支持多种过滤选项(排除目录、文件、扩展名)
  • 📊 显示文件大小和修改时间
  • 💾 支持输出到文件
  • 📈 统计信息显示

安装

从 PyPI 安装(推荐)

pip install zhangtree

从源码安装

git clone https://github.com/yourusername/zhangtree.git
cd zhangtree
pip install .

使用方法

基本用法

# 显示当前目录结构
tree

# 显示指定目录
tree C:\Users
tree /home/user

# 限制显示深度
tree -L 2

# 只显示目录
tree -d

# 显示隐藏文件
tree -a

# 显示文件大小
tree -s

# 显示修改时间
tree -t

# 同时显示大小和时间
tree -s -t

# 保存到文件
tree -o tree.txt

高级用法

# 排除指定目录
tree --exclude-dir .git --exclude-dir node_modules

# 排除指定扩展名
tree --exclude-ext .pyc --exclude-ext .log

# 排除指定文件
tree --exclude-file foo.py --exclude-file bar.txt

# 显示统计信息
tree --stats

# 显示详细信息(包括错误信息)
tree -v

命令行选项

选项 说明
path 目标目录路径(默认为当前目录)
-L, --level 显示深度限制(默认:99)
-d, --dir-only 只显示目录
-a, --all 显示隐藏文件
-s, --size 显示文件大小
-t, --time 显示修改时间
-o, --output 输出到文件
--stats 显示统计信息
-v, --verbose 显示详细信息
--exclude-dir 排除目录(可多次使用)
--exclude-ext 排除扩展名(可多次使用)
--exclude-file 排除文件(可多次使用)

示例输出

目录结构: D:\project
================================
project/
├── src/
│   ├── main.py (2.5 KB) [2024-01-15 10:30]
│   └── utils.py (1.2 KB) [2024-01-14 15:20]
├── tests/
│   └── test_main.py (0.8 KB) [2024-01-13 09:15]
├── README.md (3.1 KB) [2024-01-16 14:45]
└── requirements.txt (0.2 KB) [2024-01-10 11:00]

开发

# 克隆仓库
git clone https://github.com/yourusername/zhangtree.git
cd zhangtree

# 安装开发依赖
pip install -e .

# 运行测试
python tree.py

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request!

作者

Your Name

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zhangtree-0.1.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zhangtree-0.1.0-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file zhangtree-0.1.0.tar.gz.

File metadata

  • Download URL: zhangtree-0.1.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for zhangtree-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e339484bd784d5df1f2181867484e6c84fc7f99440143bd8daae76c9f5c2a3b1
MD5 71d59d175119faffe8147d63feb1ace4
BLAKE2b-256 61618d364b0188481b94bbfed9d4f676cae2f72032ddf4a42800366bf4faa6d0

See more details on using hashes here.

File details

Details for the file zhangtree-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zhangtree-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for zhangtree-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e0c1af956b3b3bad96aaac5ca8fa693094a807a6ed0190cdf30c150b2e80ce0
MD5 afae78839524e08f81002436c3e484a1
BLAKE2b-256 6ec768dc220c1e00508c97ee723e6a4b3d75a1afa7947c5b0252455ce2555491

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page