Skip to content
Edith

Docs

Command reference

ed machines files rename

Renames one path, leaving it in the directory it is already in.

Output
ed machines files rename <machine> <path> <name> [--json]
Name Type / values Default What it does
machine machine name, SSH alias, id or unambiguous prefix required Which machine.
path remote path required What to rename.
name a bare name, no slashes required What to call it.
--json flag off Emit JSON on stdout.
JSON
{  "done": true,  "machine": "Devbox",  "path": "/home/you/notes.md",  "to": "/home/you/journal.md"}
Output
ed machines files rename devbox /home/you/notes.md journal.mded machines files rename devbox /srv/app.conf app.conf.baked machines files rename devbox /tmp/report.txt summary.txt --json

The new name is joined to the original path's directory, so the file stays where it is. A name containing a slash is refused before anything is sent, and exits 1 rather than 2:

Output
$ ed machines files rename devbox /home/you/notes.md sub/journal.mderror: a new name cannot contain a slashhint: use `ed machines files mv` to move it somewhere else

The rename is guarded on the machine: it tests for the target first and gives up with status 17 if something is already there, so an existing name is refused rather than overwritten. That guard prints nothing, which is why the refusal arrives without detail:

Output
$ ed machines files rename devbox /home/you/notes.md deploy.sherror: renamed to /home/you/deploy.sh failed on Devbox

The to field carries the full new path, not the bare name you typed, and so does the human line, which reads renamed to /home/you/journal.md.

Where to go next