mv
| Function | Moves or renames pages. With two paths, moves the source if the destination exists; otherwise, renames it. With multiple sources, or with a pipe, moves them under an existing destination. |
| Options | -n, --dry-run — previews moves without writing; reports would-move / failed, and shows a cross-space line. -y, --yes — confirms a cross-space move (required unless -n). |
| Limitations | You can’t move spaces. A cross-space move (including a mixed batch) needs -y / --yes; nothing is written until confirmed. Same-space moves don’t need -y. Cross-space rename is not allowed — DEST must already exist in the other space. A source page whose title already exists in the target space is skipped and reported. A destination like /Name that is not an existing space reports “No such space”. Glob * / ? on the last segment of each source argv path only (not DEST; not piped stdin). Zero matches is an error. You can also pipe paths from find -name. At most 100 sources. You can’t move a page into itself or a descendant. A new title can’t contain /. If a source fails, Shell keeps the successful moves. Folders are refused. |
With two arguments:
- If
DESTexists, moveSOURCEunder that page or space. - If
DESTdoes not exist and has no slash, renameSOURCEtoDEST.
With three or more arguments, the last argument is the destination parent. Earlier arguments are sources.
With a pipe, stdin is a list of source paths (one per line, as from find / grep). The only command-line path argument is DEST. Argv sources are not merged with stdin. Optional -n / --dry-run may appear with DEST. Piped sources may be in another space than DEST; then the whole batch needs -y (preview with -n, which prints a cross-space line). find … | cp DEST copies across spaces without -y.
Cross-space moves are allowed and descendants move with the page. A cross-space target (including a mixed batch) requires -y / --yes; -n prints a cross-space line and, when available, the descendant count.
Flags may appear anywhere among the arguments.
Examples
Section titled “Examples”$ mv oldTitle newTitle$ mv ./page ./otherParent$ mv -n ./pageA ./folder$ mv pageA pageB destParent$ mv Draft* ./Archive$ find ./folder -name 'Draft*' | mv -n ./Archive$ find ./folder -name 'Draft*' | mv ./Archive$ mv -y ./Page "/Other Space/Parent"Move found pages to another space (pipe)
Section titled “Move found pages to another space (pipe)”$ find /Eng/Projects -name 'Draft*' -prune | mv "/Other Space/Archive" -ndry-run: 2 would move, 0 failedwould move: /Eng/Projects/Draft-APIcross-space: ENG -> OPS (descendants move with the page: 1)would move: /Eng/Projects/Draft-UIcross-space: ENG -> OPS (descendants move with the page: 0)$ find /Eng/Projects -name 'Draft*' -prune | mv "/Other Space/Archive" -ymoved 2 page(s)Each page moves with its descendants (here Draft-API takes its child page along); -prune keeps child pages from being piped next to their parents. Without -y nothing is written. A page whose title already exists in the target space is skipped and reported (counted as failed; the other pages still move).