remote file copy 



rcp [-Dp] file1 file2

rcp -r [-Dp] file1 ... filen directory


rcp copies files between machines. Each file or directory argument is either a remote file name of the form


or a local file name.

If path is not a full path name, it is interpreted relative to the HOME directory of the specified user rname on rhost. The local user name (that is, the name you are currently logged in as) including either your domain name (or your machine name if you are not a domain user) is used as rname if no other remote user name is specified.


rcp uses the colon (:) to separate the host name and path name which can create problems when you want to specify local file names which contain a colon following a drive letter. As a result, when a file argument on the command line is of the x:path (that is, a single letter followed by a colon and a path name), rcp treats the argument as path on drive x of the local system as opposed to path on a host named x. As an alternative, you can specify local file names on a rcp command line, by using an equal sign (=) in place of the colon and prefixing the name with a slash. For example, you could specify the local file c:/testfile as /c=/testfile.

rcp does not prompt for passwords; it performs remote execution using rsh and requires the same authorization as that command. The rsh reference page provides additional information on how rsh communicates with a rshd service (or daemon) to execute commands remotely.

If an attempted rcp connection to the host fails because of an error matching "permission.*denied" or "remuser too long in a case-insensitive manner, the utility immediately tries again, sending only the user name without domain (or machine) information.


Because the rsh and rcp utilities resend the current without the domain if it is too long and the rlogin utility does not, a user may require two entries in the hosts.equiv or .rhosts file. If the full name (including domain) is too long for the rshd service (or daemon) being used, the user needs one entry with the full user name (including domain) for use with rlogind and a second with the the same user name minus the domain for use with rshd.

rcp handles third party copies, where neither source nor target files are on the current machine.

If rcp fails with a TIMEOUT error on Windows 8.1/2012R2/10/2016/2019/11/2022 when it should have succeeded, the user can tell rcp to retry with:


A TIMEOUT error is indicated by the following error message:

A connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because
connected host has failed to respond.



enables socket debugging on the TCP sockets used for communication with the remote host.


attempts to preserve (duplicate) the modification times and modes of the source files in the copies created. By default, the mode and owner of the destination file (file2) are preserved if the file already existed; otherwise, the mode of the source file (file1) modified by the umask on the destination host is used.


treats the last command line argument as the target directory and copies all preceding arguments (that is, the source files) to that directory. If any of the source files are directories, rcp copies each subtree rooted at that name to the target directory.


Because rcp connects to a rshd service (or daemon), the information provided in the Troubleshooting section of the rsh reference page may prove useful should problems arise.



When this environment varible is set, the rsh, rcp, rexec, and rlogin utilities retry up to five times if they get the WSAENOTSOCK error. The WSAENOTSOCK error is reported as:

An operation was attempted on something that is not a socket

when set, rcp retries to establish a connection when it fails with a TIMEOUT error on Windows 8.1/2012R2/10/2016/2019/11/2022.


Possible exit status values are:


Successful completion.


An error occurred.


When the destination machine is running the BSD 4.2 version of rcp, the destination user and host name may have to be specified as rhost.rname.


This product includes software developed by the University of California, Berkeley and its contributors.


All UNIX systems. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.

Linux and UNIX versions of rcp do not support including domain information in rname. This functionality is an MKS extension.


PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


cp, rsh, rshd

File Formats:
hosts.equiv, rhosts

MKS Toolkit Connectivity Solutions Guide

PTC MKS Toolkit 10.4 Documentation Build 39.