COPY(1XNX)

NAME
copy - (XENIX) copy groups of files

SYNOPSIS
copy [-a[d]] [-nlsmorvh] source . . . [destination]

DESCRIPTION
The copy command creates a copy of each source file in destination. If no destination argument is present, the current directory is used. If more than one source argument is given, destination must be an existing directory; otherwise, if destination does not exist, it is created. For a directory given as source, its contents are copied to destination, but subdirectories are normally ignored (see the -r option below). Special files are copied as such.

If a destination file exists, its content will be overwritten, but it will retain its permissions and ownership. Otherwise, files are created with the owner and group set to those of the invoking user and with the permissions of the source file (minus umask, see umask(2)).

The copy command accepts the following options, which may be given at any position regarding the file operands:

-a  Asks for confirmation for each file before a copy is attempted, and for each directory before it is examined.

-ad Asks for confirmation for each directory before it is examined. Implies the -r option.

-h  By default, symbolic links are followed. This option causes symbolic links encountered during traversal to be copied (symbolic links given as arguments will still be followed).

-l  If possible, files are hard linked instead of being copied. This does not apply to directories or special files.

-m  Sets access and modification times of copied files to those of source files instead of current time.

-n  Create new files only: If a destination file exists, it is not overwritten.

-o  Sets the owner and group of each destination file to those of the source file instead of those of the invoking user.

-r  Recusively copies subdirectories of the source arguments encountered.

-s  Similar to -l, but uses soft links.

-v  Prints the name of each file or directory before it is copied or examined.

SEE ALSO
cp(1), cpio(1)

NOTES
Files copied will lose all hard link connection.

In contrast to cp(1), if a directory is copied to an existing destination directory, its contents will be written directly into that directory, without a subdirectory being created. For example, if the directory source contains the files file1 and file2, the command

    copy source dest

will create files dest/file1 and dest/file2, while the command

    cp -r source dest

will create dest/source/file1 and dest/source/file2. Thus if a single directory is named and no explicit destination is given, copies of the files below that directory will be created in the current directory.