file-manager

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

File Manager

File Manager

管理文件和目录的工具集。
A set of tools for managing files and directories.

When to Use

When to Use

  • 创建、删除、移动、复制文件或目录
  • 读取或写入文件内容
  • 搜索文件
  • 列出目录内容
  • 获取文件信息(大小、修改时间等)
  • Create, delete, move, copy files or directories
  • Read or write file content
  • Search for files
  • List directory contents
  • Get file information (size, modification time, etc.)

Instructions

Instructions

列出目录

List Directory

bash
python scripts/file_ops.py list <path> [--recursive] [--pattern "*.py"]
bash
python scripts/file_ops.py list <path> [--recursive] [--pattern "*.py"]

读取文件

Read File

bash
python scripts/file_ops.py read <file_path> [--encoding utf-8]
bash
python scripts/file_ops.py read <file_path> [--encoding utf-8]

写入文件

Write File

bash
python scripts/file_ops.py write <file_path> --content "内容" [--append]
bash
python scripts/file_ops.py write <file_path> --content "content" [--append]

复制文件

Copy File

bash
python scripts/file_ops.py copy <source> <destination>
bash
python scripts/file_ops.py copy <source> <destination>

移动/重命名

Move/Rename

bash
python scripts/file_ops.py move <source> <destination>
bash
python scripts/file_ops.py move <source> <destination>

删除

Delete

bash
python scripts/file_ops.py delete <path> [--recursive]
bash
python scripts/file_ops.py delete <path> [--recursive]

搜索文件

Search File

bash
python scripts/file_ops.py search <directory> --pattern "*.py" [--content "search_text"]
bash
python scripts/file_ops.py search <directory> --pattern "*.py" [--content "search_text"]

获取文件信息

Get File Information

bash
python scripts/file_ops.py info <path>
bash
python scripts/file_ops.py info <path>

Output Format

Output Format

所有操作返回 JSON 格式:
json
{
  "success": true,
  "operation": "list",
  "data": {
    "files": ["file1.py", "file2.py"],
    "directories": ["subdir"],
    "count": 3
  }
}
All operations return JSON format:
json
{
  "success": true,
  "operation": "list",
  "data": {
    "files": ["file1.py", "file2.py"],
    "directories": ["subdir"],
    "count": 3
  }
}

Safety Notes

Safety Notes

  • 删除操作不可恢复,谨慎使用
  • 写入文件会覆盖原有内容(除非使用 --append)
  • 对于重要文件,建议先备份
  • Deletion operations are irreversible, use with caution
  • Writing to a file will overwrite existing content (unless using --append)
  • For important files, it is recommended to back them up first