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. |
| Limitations | Same space only. You can’t move spaces. 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. |
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.
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