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.1.tar.gz (5.6 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.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zhangtree-0.1.1.tar.gz
  • Upload date:
  • Size: 5.6 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.1.tar.gz
Algorithm Hash digest
SHA256 3a5b59590e0e90dcee92371b4dd0ecf7b0cc39479b77b4b2c053ec7ff2817d1d
MD5 f93b75919c75e241f0b6e55f2413b523
BLAKE2b-256 de179686c888c7663b27a0aa5493f41d44a24b3053760253414b7be4aa94b97f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zhangtree-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 79a33256bb36ec282758174761dadc50da572d32b3cb3e4350f2249bd258a94d
MD5 b762801678cc08b4ace2a0aebe6a2ff5
BLAKE2b-256 dc733a0c5bf0c0be5463eaaa8a4df081c663835948e76721179744cbe4b45884

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