Modular Computers the manual GitHub

rcp

rcp: copy files between computers.

Synopsis

rcp [-r] source [source…] target

Description

rcp copies files to or from another computer. The sources are all on one side and the target on the other: a remote name is host:path (host as rsh(1) takes it, found once for the whole copy); a name with no colon, or with a / before its colon, is local.

A target that’s a directory (or ends with /) gets each source by its name in it; otherwise the source becomes the target. With more than one source, the target must be a directory.

It’s rsh underneath, as BSD’s rcp was: on the other computer, cat reads or writes each file, mkdir -p makes the directories, and find lists a remote directory’s tree.

Options

-r
Copies directories, and everything in them. Without it, a directory source is refused. A link is copied as what it leads to (a file’s contents); it’s never followed into a directory.

Exit status

0 when everything was copied; 1 when something couldn’t be read or written (the rest is still copied), or the other computer can’t be reached.

Examples

rcp /notes 1b9c0e:/notes
rcp 1b9c0e:/log /tmp/
rcp /a.lua /b.lua 1b9c0e:/bin/
rcp -r /projects 1b9c0e:/backup/

Notes

BSD’s rcp keeps files’ times with -p; this one doesn’t. Both ends being remote isn’t supported.

See also

rsh(1), cp(1)