cpcopy files |
Command |
cp
[-cfimpv
]
file1 file2
cp
[-cfimpv
] file ...
directory
cp
-R
[-cfimpv
]
source... directory
cp
-r
[-cfimpv
]
source... directory
cp
copies files to a target named by the last argument on
its command line. If the target is an existing file, cp
overwrites it; if it does not exist, cp
creates it. If the
target file already exists and does not have write permission,
cp
denies access and continues with the next copy.
If you specify more than two path names, the last path name (that is, the
target) must be a directory. If the target is a directory, cp
copies the sources into that directory with names given by the final component
of the source path name.
-c
prompts you to change the diskette if there is insufficient room to complete a copy operation. The parent directories must already exist on the new target diskette. This option has no effect on systems without floppy drives.
-f
attempts to replace files that do not have write permission.
-i
asks you if you want to overwrite an existing file, whether or not the file is read-only.
-m
sets the modify and access time of each destination file to that of the
corresponding source file. Normally, cp
sets the
modification time of the destination file to the present.
-p
preserves the modify and access times (like -m
) as
well as the file mode, owner and group owner, if possible. The compression
and archive attributes are never copied.
-R
reproduces the source trees. cp
copies all files
and subdirectories specified by source.... into directory,
making careful arrangements to duplicate special files (FIFO, block
special, character special).
-r
reproduces the source trees, but makes no allowances for special files
(FIFO, block special, character special). Consequently,
cp
attempts to read from a device rather than
duplicate the special file. This is similar to, but less useful than, the
preferred -R
.
-v
prints file names to standard output as they are being processed.
0
Successful completion.
1
Failure due to any of the following:
/
) but was not
a directory-r
or
-R
-r
or -R
errors
include:2
Failure due to any of the following:
cp
has no space to hold the name of the target file.
Try to free up some memory to give cp
more
space.
You did not specify -r
or -R
,
but one of the names you asked to copy was the name of a directory.
You are attempting to copy a file with the -i
option, but there is already a file with the target name. If you have
specified -f
, you can write over the existing file by
typing y
and pressing ENTER; if you do not want to write over
the existing file, type n
and press ENTER. If you did not
specify -f
and the file is read only, you are not
given the opportunity to overwrite it.
The source and the target are actually the same file (for example
because of links, on UNIX and POSIX-compliant systems). In this case,
cp
does nothing.
cp
cannot read the specified directory, for example,
because you do not have appropriate permissions.
-c
, -f
, -m
, and
-v
options are extensions to the POSIX standard.