360 Secure SkillHub
360 安全技能中心

Simple File Backup

该 Skill 通过 shell 命令将指定文件复制为同目录下带 YYYYMMDD_HHMMSS 时间戳的 .bak 备份;成功时无输出并返回 0,失败时显示 cp 错误;可用 ls 查看结果。未包含恢复、清理或内容校验流程。

分类:自动化
jinwangmok
jinwangmok
热度 29.97
最近更新 2026-05-11 17:37:41

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add jinwangmok/simple-file-backup
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
file-backup
version
1.0.0
description
Create a timestamped backup copy of a file in the same directory. Use when the user wants to save a copy of a file before making changes.
allowed-tools
Bash(cp:*)
metadata
{"openclaw":{"emoji":"📋","requires":{"bins":["cp","date"],"env":[]},"install":[]}}

File Backup

Create a timestamped backup copy of any file with a single command.

Usage

cp <FILE_PATH> <FILE_PATH>.bak.$(date +%Y%m%d_%H%M%S)

Arguments:

# Name Description
1 FILE_PATH Path to the file to back up

Example

cp /home/user/config.yaml /home/user/config.yaml.bak.$(date +%Y%m%d_%H%M%S)

Output:

(no output on success)

The backup file is created as: ORIGINAL_NAME.bak.YYYYMMDD_HHMMSS

Example: config.yaml → config.yaml.bak.20260328_143022

Success / Failure

  • Success: No output, exit code 0. Backup file created in same directory.
  • Failure: Error message from cp (exit code non-zero, e.g. file not found)

Verify Backup

To confirm the backup was created:

ls -la <FILE_PATH>.bak.*