| United States-English |
|
|
|
![]() |
Using Your HP Workstation > Chapter 11 Communicating over a NetworkCopying Files Remotely with rcp |
|
You can use the HP-UX rcp (Remote Copy) program to copy files or directories to and from a remote system or to copy among remote systems. If your system administrator has already configured your system to use remsh, you can use rcp without any additional setup. To use rcp, you will need the following:
To copy from your system to a remote system, use the following:
Note that, if local_file is not in your current directory, you will need to supply the relative path (from your current directory) or the absolute path name (from /), in addition to the local file name. Specify the complete (absolute) path for the remote_file on remote_hostname only if you want to place it in a directory other than the remote home directory. Examples. To copy myfile from your current directory to a remote system called hpxyz:
In this case, myfile will be copied as myfile into the remote subdirectory, otherdir. If you had only supplied the remote host name, rcp would have copied myfile into the remote home directory, also as myfile. You can also include a file name in the destination. For example, to copy to a system named hpxyz:
In this case, you have copied myfile as otherfile, in the remote directory leslie. To copy a file from a remote system into your local directory, use the following syntax:
Example. To copy myfile from your account in a remote system hpxyz into your current directory:
The dot (.) is shorthand for "current directory". In this case, myfile will be copied from the remote directory into your current directory as myfile. If you want to copy the file to a new name, supply the destination file name. If you want to copy myfile into another directory in your home system, use a path name, absolute or relative, as shown:
Or, if you want to copy the file to another file name in another directory:
To copy a local directory with all its files and subdirectories to a remote system, use rcp with the -r (recursive) option. The syntax is as follows:
If local_dir is not in your current directory, you will need to supply the relative path name (from your current directory) or the absolute path name (from /, the top of the directory hierarchy), in addition to the local directory name. Also, if remote_dir is not in your home directory, the remote_dir will require a relative path (from your home directory) or an absolute path (from /). For more information, see “The Hierarchical File System”. Example. To copy an entire subdirectory called work to a directory called products in your home directory on a remote computer called hpabc, type the following:
This command creates a directory named work, with all its contents, in hpabc:/home/leslie/products (provided that /home/leslie/products already exists on hpabc). The example assumes that you are in the local directory containing work. Otherwise, you would have to give a relative or absolute path to that directory, such as /home/leslie/work. To copy a remote directory with all its files and subdirectories to a local directory, use rcp with the -r (recursive) option in the following syntax:
Example. To copy a remote directory called work to your current directory, type the following:
The dot (.) indicates the current directory. The work directory will be created in this directory. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||