Install
openclaw skills install rename-fillRename files in a specified directory with a given prefix. This skill prompts the user for a prefix and directory path, shows a preview of changes, and asks for confirmation before executing. Uses Node.js script for cross-platform compatibility.
openclaw skills install rename-fillThis skill renames all files in a specified directory by adding a prefix to each filename. It shows a preview of changes and asks for user confirmation before executing the rename operation.
Use this skill when:
The skill uses a JavaScript script for file operations, which requires Node.js to be installed.
Use AskUserQuestion to get:
Example AskUserQuestion call for prefix and directory:
{
"questions": [{
"question": "What prefix should be added to the filenames?",
"header": "Prefix",
"options": [
{"label": "Enter custom prefix", "description": "I'll type a prefix (e.g., 'photo_', 'backup_')"}
],
"multiSelect": false
}, {
"question": "Which directory contains the files to rename?",
"header": "Directory",
"options": [
{"label": "Current directory", "description": "Use current working directory"},
{"label": "Custom path", "description": "I'll specify a different directory"}
],
"multiSelect": false
}]
}
After getting answers:
Read the directory contents and generate a preview of rename operations:
Display the preview to the user and ask for confirmation:
{
"questions": [{
"question": "Preview: ${count} files will be renamed with prefix '${prefix}'. Proceed?",
"header": "Confirmation",
"options": [
{"label": "Yes, rename files", "description": "Execute the rename operation"},
{"label": "No, cancel", "description": "Cancel without making changes"}
],
"multiSelect": false
}]
}
If user confirms, run the JavaScript rename script:
# Get the path to this skill directory
SKILL_DIR="$(dirname "$0")/rename-file"
# Run the JavaScript rename script
node "$SKILL_DIR/scripts/rename-files.js" "<prefix>" "<directory-path>"
Show the user:
The JavaScript script (scripts/rename-files.js):
fs.renameSyncUser: /rename-file
Assistant: Asks for prefix and directory
User: Prefix: "vacation_", Directory: "./photos"
Assistant: Shows preview: "photo1.jpg" → "vacation_photo1.jpg", etc.
User: Confirms
Assistant: Renames files and shows summary