mcpField
F
file-manager

file-manager

github.com/ninehills生产力277124 次安装19 周前更新
代码仓库

关于 file-manager

一个文件管理技能,通过 Shell 命令帮助用户查找、整理、检查、压缩和解压文件。它还提示在批量更改前预览结果,并在删除前征求确认。

主要功能

  1. 01按名称、类型或大小查找文件
  2. 02移动和重命名文件
  3. 03检查较大或较旧的下载文件
  4. 04创建和解压归档文件
  5. 05删除前预览影响范围

适用场景

  1. 01查找报告或特定类型的文件
  2. 02整理已下载的文档
  3. 03检查下载目录的空间占用
  4. 04归档或解压文件夹

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/ninehills/skills --skill file-manager

安装后在 Claude Code 中输入/file-manager确认已加载。

详细介绍

文件管理器技能

帮助用户查找和整理电脑上的文件。

查找文件

# By name (case-insensitive)
find ~/Desktop ~/Documents ~/Downloads -iname "*report*" -type f 2>/dev/null

# By extension
find ~/Downloads -name "*.pdf" -type f

# By size (larger than 100MB)
find ~ -size +100M -type f 2>/dev/null | head -20

# Recently modified (last 7 days)
find ~/Documents -mtime -7 -type f | head -20

# Duplicates by size (potential dupes)
find ~/Downloads -type f -exec ls -la {} + | sort -k5 -n | uniq -d -f4

整理

# Move all PDFs from Downloads to Documents
mv ~/Downloads/*.pdf ~/Documents/

# Create dated folder and move files
mkdir -p ~/Documents/$(date +%Y-%m-%d)

# Rename files (pattern)
for f in *.jpeg; do mv "$f" "${f%.jpeg}.jpg"; done

清理

# Show large files in Downloads
du -sh ~/Downloads/* | sort -rh | head -20

# Empty trash (macOS)
rm -rf ~/.Trash/*

# Clear old downloads (older than 30 days)
find ~/Downloads -mtime +30 -type f

压缩/解压

# Create zip
zip -r archive.zip folder/

# Create tar.gz
tar czf archive.tar.gz folder/

# Extract
unzip archive.zip
tar xzf archive.tar.gz

提示

  • 在可用时,始终优先使用 trash,而不是 rm(可恢复)
  • 批量操作前预览文件列表
  • 删除前先征求同意——先展示受影响的内容

评论

支持 Markdown