Rename or move a file
ptero_rename_fileRename or move a file or directory on a Pterodactyl server, relative to a root path, including moves between directories. Safe alternative to deletion, with protected-path checks.
Instructions
Rename a file or directory — and, because from and to are both interpreted relative to root, MOVE it between directories too. root="/", from="plugins/old.jar", to="plugins/disabled/old.jar" moves the jar into the disabled folder. The destination directory must already exist.
This is the safe way to take a plugin or config out of service: rename it rather than deleting it, and it can be renamed back. Prefer this over ptero_delete_file whenever the change might need undoing.
Both the source and the destination are checked against PTERODACTYL_PROTECTED_PATHS, so a rename cannot be used to move something out of a protected directory. No backup is taken (nothing is destroyed) and no confirmation is required, but the call is counted against PTERODACTYL_MAX_MUTATIONS and audited.
It does not create directories and it does not overwrite: if to already exists the panel returns an error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | New path, relative to `root`. Give a different directory here to move the file rather than just rename it. Must not already exist. | |
| from | Yes | Existing path, relative to `root`. E.g. `plugins/old.jar`. | |
| root | No | Directory that `from` and `to` are relative to. Defaults to `/` (the server root), which lets you move between directories by giving full paths in `from` and `to`. | / |
| server | No | Server short identifier (e.g. 1a2b3c4d). Omit to use PTERODACTYL_DEFAULT_SERVER. Call ptero_list_servers to discover valid identifiers. | |
| dry_run | No | When true, validate and preview the change without performing it. Nothing is modified and no confirmation token is issued. Use this to reason about an operation before committing to it. | |
| confirmation_token | No | Two-phase confirmation token. Leave this out on the first call: the tool will refuse to act and instead return a preview of exactly what would change, plus a single-use token that expires in 120 seconds. THE PREVIEW IS FOR THE HUMAN — show it to the user in your reply and let them decide. Do not silently round-trip the token back in an immediate second call. Only call again with the token once the user has seen the preview and approved it. The token is bound to a hash of these exact arguments, so changing any argument invalidates it. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | ||
| from | No | ||
| root | No | ||
| reason | No | Why the call was refused. | |
| server | Yes | ||
| status | Yes | success = the change was made. refused = a guardrail blocked it (see reason/variable). dry_run = nothing changed; preview shows what would. needs_confirmation = nothing changed; SHOW the preview to the human and, only if they agree, call again with confirmation_token. | |
| message | No | ||
| preview | No | What would / did change. | |
| to_path | No | Full server-relative destination path. | |
| variable | No | Environment variable that caused the refusal. | |
| backup_id | No | UUID of the automatic pre-change backup, if one was taken. | |
| from_path | No | Full server-relative source path. | |
| expires_in_s | No | ||
| confirmed_via | No | ||
| confirmation_token | No |