Using HP-UX Internet Services (August 2003)

Transferring Files with rcp
Using rcp
Chapter 4 33
Using rcp
You can use rcp to copy one or more files or directories from the local
host to a remote host, as in the following example:
rcp /tmp/memo1 /tmp/memo2 basil:/home/roger
This example copies the files /tmp/memo1 and /tmp/memo2 from the local
host to the user Roger’s home directory on the host basil. The last path
specified on the command line is considered as the destination path. The
files specified in the paths before the destination path denote the files
that are to be copied.
You can use rcp to copy one or more remote files or directories to the
local host. With the -r (recursive) option, you can use rcp to copy the
contents of a directory and all its subdirectories, as in the following
example:
rcp -r sage:/home/gwen /home/gwen
This example copies the contents of user gwen’s home directory from the
host sage to the directory /home/gwen on the local host.
If you do not specify the entire path name, the path name is interpreted
relative to your home directory, as in the following example:
rcp memo* *mail sage:june_mail
This example copies all files whose names begin with memo and all files
whose names end with mail from the user’s local home directory to the
directory june_mail in the user’s home directory on host sage.
NOTE Any output generated by commands in a .login, .profile, or .cshrc
file on the remote host can cause rcp errors.
IMPORTANT Do not attempt to copy a file over itself, as in the following example:
rcp /home/cheryl/.profile /home/cheryl/.profile
This can corrupt the file’s contents.