name: file-manager-service description: 檔案管理服務,支援服務啟停、Web 介面瀏覽、檔案上傳下載和目錄管理
操作執行在 http://127.0.0.1:8888 的檔案管理服務,管理使用者家目錄下的 ~/.openclaw/workspace/projects 目錄。
file-manager-service/
├── SKILL.md # Skill 定義
├── README.md # 使用說明
├── _meta.json # 後設資料
├── .gitignore # Git 忽略檔案
└── scripts/
├── file_manager.py # 客戶端指令碼(含服務管理)
├── server.py # Flask 服務端
├── templates/
│ └── index.html # Web 介面模板
├── .service.pid # 服務程序 ID(執行時生成)
└── .service.log # 服務日誌(執行時生成)
# 啟動服務
python scripts/file_manager.py start
# 停止服務
python scripts/file_manager.py stop
# 重啟服務
python scripts/file_manager.py restart
# 檢視狀態
python scripts/file_manager.py status
# 開啟 Web 頁面
python scripts/file_manager.py open
# 列出檔案
python scripts/file_manager.py list
# 列出指定目錄
python scripts/file_manager.py list ai-agent-enterprise-design
# 檢視檔案內容
python scripts/file_manager.py cat path/to/file.md
# 搜尋檔案
python scripts/file_manager.py search 關鍵詞
# 統計資訊
python scripts/file_manager.py stats
# 建立目錄(自動遞迴建立父目錄)
python scripts/file_manager.py mkdir parent/path NewDirName
# 刪除檔案/目錄
python scripts/file_manager.py delete path/to/item
# 移動檔案/目錄
python scripts/file_manager.py move source/path dest/path
# 獲取/設定目錄備註
python scripts/file_manager.py note directory-name
python scripts/file_manager.py note directory-name 備註內容
# 上傳檔案(支援多個檔案)
python scripts/file_manager.py upload file1.md file2.py
python scripts/file_manager.py upload *.txt -p project/docs
| 操作 | 端點 | 方法 |
|---|---|---|
| 列出檔案 | /api/files?path=xxx |
GET |
| 獲取檔案內容 | /api/file/content?path=xxx |
GET |
| 儲存檔案 | /api/file/save |
POST |
| 下載檔案 | /api/file/download?path=xxx |
GET |
| 刪除 | /api/delete |
POST |
| 移動 | /api/move |
POST |
| 建立目錄 | /api/create/dir |
POST |
| 建立檔案 | /api/create/file |
POST |
| 搜尋 | /api/search?q=xxx®ex=true |
GET |
| 統計 | /api/stats |
GET |
| 獲取備註 | /api/notes/get?path=xxx |
GET |
| 儲存備註 | /api/notes/save |
POST |
| 目錄樹 | /api/tree?path=xxx |
GET |
| 下載目錄 | /api/download?path=xxx |
GET |
| 上傳檔案 | /api/upload |
POST |
| 批次上傳 | /api/upload-folder |
POST |
python scripts/file_manager.py start
python scripts/file_manager.py open
python scripts/file_manager.py status
輸出:
{
"running": true,
"pid": 84078,
"url": "http://127.0.0.1:8888",
"service_dir": "/Users/lengyanhua/.openclaw/skills/file-manager-service/file-manager-service"
}
# 自動建立 a/b/c 目錄鏈
python scripts/file_manager.py mkdir a/b NewDir
# 自動建立父目錄後建立檔案
python scripts/file_manager.py mkdir x/y test.txt "檔案內容"
上傳: 不限制檔案型別,支援任意格式(.pdf, .docx, .xlsx, .zip, 圖片,影片等)
線上檢視/編輯: .txt, .md, .html, .py, .js, .json, .yaml, .yml, .css, .xml, .log, .sh, .bash, .sql, .java, .go, .rs, .ts, .jsx, .tsx, .htm, .svg
注意: 非文本檔案(如 PDF、圖片)可上傳和下載,但無法線上預覽編輯
~/.openclaw/workspace/projects 內. 開頭)不顯示服務啟動失敗:檢查 scripts/.service.log 日誌檔案
埠被佔用:lsof -ti :8888 | xargs kill -9 然後重新啟動
路徑非法:確保路徑在允許的根目錄內
檔案型別不支援:檢查副檔名是否在允許列表中
許可權錯誤:確認家目錄可寫(macOS 上不要使用 /root 路徑)
小蔥技能有更好的技能skills外掛。
整體質量較好,功能豐富實用,文件清晰易懂。優點是操作簡單、介面美觀、支援批次上傳和安全限制。不足是啟動依賴特定埠容易衝突,目錄備註功能受限較多,部分情況需檢視日誌排查問題。適合需要頻繁管理專案檔案的開發者使用。