Command Reference Guide

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/!!!intro.1
________________________________________________________________
___ ___
c
cp(1) cp(1)
-R (recursive subtree copy) The -R option is identical to the -r option with the exception that direc-
tories copied by the -R option are created with read, write, and search permission for the owner.
User and group permissions remain unchanged.
With the -R and -r options, in addition to regular files and directories, cp also copies FIFOs,
character and block device files and symbolic links. Only superusers can copy device files. All
other users get an error. Symbolic links are copied so the target points to the same location that
the source did.
Warning: While copying a directory tree that has device special files, use the -r option; otherwise,
an infinite amount of data is read from the device special file and is duplicated as a special file in
the destination directory occupying large file system space.
-e extarg
Specifies the handling of any extent attributes of the file[s] to be copied. extarg takes one of the
following values.
warn Issues a warning message if extent attributes cannot be copied, but copies the file
anyway.
ignore Does not copy the extent attributes.
force Fails to copy the file if the extent attribute can not be copied.
Extent attributes can not be copied if the files are being copied to a file system which does not sup-
port extent attributes or if that file system has a different block size than the original. If
-e is not
specified, the default value for extarg is
warn.
Access Control Lists (ACLs)
If new_file is a new file, or if a new file is created in dest_directory, it inherits the access control list of the
original file1, file2, etc., altered to reflect any difference in ownership between the two files (see acl(5) and
aclv(5)). In JFS file systems, new files created by
cp do not inherit their parent directory’s default ACL
entries (if any), but instead retain the ACLs of the files being copied. When copying files from a JFS file
system to an HFS file system or vice versa, optional ACL entries are lost.
EXTERNAL INFLUENCES
Environment Variables
LC_CTYPE determines the interpretation of text as single and/or multi-byte characters.
LANG and LC_CTYPE determine the local language equivalent of y (for yes/no queries).
LANG determines the language in which messages are displayed.
If LC_CTYPE is not specified in the environment or is set to the empty string, the value of
LANG is used
as a default for each unspecified or empty variable. If
LANG is not specified or is set to the empty string, a
default of "C" (see lang(5)) is used instead of LANG. If any internationalization variable contains an
invalid setting, cp behaves as if all internationalization variables are set to "C". See environ(5).
International Code Set Support
Single- and multi-byte character code sets are supported.
EXAMPLES
The following command moves the directory sourcedir and its contents to a new location (targetdir) in the
file system. Since
cp creates the new directory, the destination directory targetdir should not already
exist.
cp -r sourcedir targetdir && rm -rf sourcedir
The -r option copies the subtree (files and subdirectories) in directory sourcedir to directory targetdir.
The double ampersand (&&) causes a conditional action. If the operation on the left side of the && is suc-
cessful, the right side is executed (and removes the old directory). If the operation on the left of the && is
not successful, the old directory is not removed.
This example is equivalent to:
mv sourcedir targetdir
To copy all files and directory subtrees in the current directory to an existing targetdir, use:
cp -r * targetdir
HP-UX Release 11i: December 2000 − 2 − Section 1−−115
___
___