📦 Windows文件管理器

v1.0.0

Windows文件管理器 - 原创技能。让AI执行Windows文件操作,包括文件/文件夹的创建、复制、移动、删除、搜索、重命名等。适用于文件整理、批量处理、自动化工作流等场景。

0· 8·0 当前·0 累计
0
安全扫描
VirusTotal
Pending
查看报告
OpenClaw
可疑
medium confidence
该技能的代码符合 Windows 文件管理器用途,但 SKILL.md 中的安装说明混乱(用 pip 安装 stdlib 模块),提供无安全控制的强力破坏性操作,并建议安装未声明的第三方包——这些不匹配与缺乏防护措施需引起警惕。
评估建议
This 技能 implements file operations that match its 状态d purpose, but proceed cautiously. Key points: (1) 移除 or correct the 技能.md's `pip 安装 shutil pathlib` lines — shutil and pathlib are stdlib and pip-安装ing them can fetch unrelated packages; (2) the 技能 exposes powerful destructive functions (rmtree, batch_删除) without confirmation or path restrictions — only 运行 in a sandbox or restrict it to specific directories; (3) 搜索_by_content and read_file can expose sensitive data — avoid giving the 代理 networ...
详细分析 ▾
用途与能力
Name/description clAIm a Windows file 管理器 and the 技能.md provides Python functions for 创建/copy/move/删除/搜索/rename which are coherent with that purpose. Minor mismatch: 技能 metadata 列出s only 'python' as required but the README suggests pip 安装ing packages (see 安装_mechanism). Also the 技能 设置s no OS restriction despite being Windows-focused (functions are mostly cross-平台, but documentation tar获取s Windows).
指令范围
The instructions include functions that read arbitrary files (搜索_by_content, read_file) and perform destructive actions (删除_file, 删除_folder using shutil.rmtree, batch_删除) with no built-in confirmation, sandboxing, or path restrictions. That scope is functionally 应用ropriate for a file-管理器, but the 技能.md grants broad discretion and no 运行time safety constrAInts — a risk if an 代理 运行s these autonomously or is compromised.
安装机制
The registry 列出s no 安装 spec (instruction-only), yet 技能.md recommends: `pip 安装 shutil pathlib glob2`. shutil and pathlib are Python stdlib 模块s and should not be 安装ed via pip — attempting to pip-安装 packages with those names could pull unrelated third-party code. glob2 is a third-party package but is not declared in the 技能 metadata. This mismatch (no declared 安装s vs. suggested pip commands, and pip-安装ing stdlib names) is incoherent and potentially unsafe.
凭证需求
The 技能 请求s no 环境 variables or 凭证s (proportionate). However, it implicitly requires broad file系统 访问 (read/write/删除 anywhere the 代理 can reach). That implicit requirement is expected for a file-管理器 but is worth noting as a high-impact capability even without explicit 凭证 请求s.
持久化与权限
The 技能 does not 请求 always:true, does not declare persistent/config modifications, and is user-invocable. Autonomous invocation is allowed by 平台 default; combined with the destructive file operations this increases risk but autonomy alone is not a misconfiguration in the metadata.
安全有层次,运行前请审查代码。

运行时依赖

无特殊依赖

安装命令

点击复制
官方npx clawhub@latest install laosi-file-manager
镜像加速npx clawhub@latest install laosi-file-manager --registry https://cn.longxiaskill.com

技能文档

⚠️ 发布规则 所有发布到 ClawHub 的技能必须严格测试,确认无问题后再发布。

技能测试验证清单

  • frontmatter 格式正确
  • 操作覆盖完整
  • 安全机制完善
  • 示例清晰
  • 无语法错误

Windows File Manager – Windows 文件管理器 原创技能 | 激活词:文件管理 / 文件操作 / 整理文件

功能概述 功能 说明 文件操作 创建、删除、复制、移动、重命名 文件夹操作 创建、删除、复制、移动 搜索功能 按名称、内容、类型搜索 属性管理 获取/设置文件属性、时间戳 批量操作 批量重命名、批量移动 文件比较 比较两个文件差异

安装依赖 pip install shutil pathlib glob2

核心命令

  • 文件操作
import os import shutil from pathlib import Path

# 创建文件 def create_file(file_path: str, content: str = ""): """创建文件并写入内容""" Path(file_path).parent.mkdir(parents=True, exist_ok=True) with open(file_path, 'w', encoding='utf-8') as f: f.write(content) return True

# 读取文件 def read_file(file_path: str) -> str: """读取文件内容""" with open(file_path, 'r', encoding='utf-8') as f: return f.read()

# 删除文件 def delete_file(file_path: str) -> bool: """删除文件""" if os.path.exists(file_path): os.remove(file_path) return True return False

# 复制文件 def copy_file(src: str, dst: str) -> bool: """复制文件""" Path(dst).parent.mkdir(parents=True, exist_ok=True) shutil.copy2(src, dst) return True

# 移动文件 def move_file(src: str, dst: str) -> bool: """移动文件""" Path(dst).parent.mkdir(parents=True, exist_ok=True) shutil.move(src, dst) return True

# 重命名文件 def rename_file(old_path: str, new_name: str) -> bool: """重命名文件""" directory = os.path.dirname(old_path) new_path = os.path.join(directory, new_name) os.rename(old_path, new_path) return True

  • 文件夹操作
# 创建文件夹 def create_folder(folder_path: str): """创建文件夹""" Path(folder_path).mkdir(parents=True, exist_ok=True) return True

# 删除文件夹 def delete_folder(folder_path: str): """删除文件夹(递归)""" shutil.rmtree(folder_path) return True

# 复制文件夹 def copy_folder(src: str, dst: str): """复制文件夹""" shutil.copytree(src, dst) return True

# 移动文件夹 def move_folder(src: str, dst: str): """移动文件夹""" shutil.move(src, dst) return True

# 列出文件夹内容 def list_folder(folder_path: str, pattern: str = ""): """列出文件夹内容""" path = Path(folder_path) files = list(path.glob(pattern)) return [str(f) for f in files if f.is_file()]

def list_folders(folder_path: str): """列出子文件夹""" path = Path(folder_path) return [str(f) for f in path.iterdir() if f.is_dir()]

  • 搜索功能
import glob

# 按名称搜索 def search_by_name(folder: str, pattern: str) -> list: """按名称模式搜索""" return glob.glob(f"{folder}//{pattern}", recursive=True)

# 按扩展名搜索 def search_by_extension(folder: str, ext: str) -> list: """按扩展名搜索""" if not ext.startswith('.'): ext = '.' + ext return glob.glob(f"{folder}//{ext}", recursive=True)

# 搜索包含内容的文件 def search_by_content(folder: str, keyword: str) -> list: """搜索包含关键词的文件""" results = [] for file_path in glob.glob(f"{folder}/*/", recursive=True): if os.path.isfile(file_path): try: with open(file_path, 'r', encoding='utf-8', errors='ignore') as f: if keyword in f.read(): results.append(file_path) except: pass return results

# 搜索大文件 def find_large_files(folder: str, min_size_mb: int = 10) -> list: """查找大于指定大小的文件""" results = [] for file_path in glob.glob(f"{folder}/*/", recursive=True): if os.path.isfile(file_path): size_mb = os.path.getsize(file_path) / (1024 * 1024) if size_mb >= min_size_mb: results.append({ 'path': file_path, 'size_mb': round(size_mb, 2) }) return sorted(results, key=lambda x: x['size_mb'], reverse=True)

  • 批量操作
# 批量重命名 def batch_rename(folder: str, pattern: str, replacement: str): """批量重命名文件""" files = glob.glob(f"{folder}/{pattern}") renamed = [] for i, file_path in enumerate(files): directory = os.path.dirname(file_path) filename = os.path.basename(file_path) new_name = filename.replace(pattern, replacement) new_path = os.path.join(directory, new_name) os.rename(file_path, new_path) renamed.append((file_path, new_path)) return renamed

# 批量移动 def batch_move(folder: str, pattern: str, dest_folder: str): """批量移动文件""" files = glob.glob(f"{folder}/{pattern}") Path(dest_folder).mkdir(parents=True, exist_ok=True) moved = [] for file_path in files: filename = os.path.basename(file_path) dest = os.path.join(dest_folder, filename) shutil.move(file_path, dest) moved.append((file_path, dest)) return moved

# 批量复制 def batch_copy(folder: str, pattern: str, dest_folder: str): """批量复制文件""" files = glob.glob(f"{folder}/{pattern}") Path(dest_folder).mkdir(parents=True, exist_ok=True) copied = [] for file_path in files: filename = os.path.basename(file_path) dest = os.path.join(dest_folder, filename) shutil.copy2(file_path, dest) copied.append((file_path, dest)) return copied

数据来源ClawHub ↗ · 中文优化:龙虾技能库