COPY(1)

NAME
copy - makes copies of file(s)

SYNOPSIS
copy -i [ options ]

copy with prompt for filenames

copy [ options ] from_file to_file

copy a single file

copy [ options ] from1...fromn targetdir

copy multiple files into one directory that must exist

DESCRIPTION
Copy makes a copy of the first file and gives it the second filename. If the first file does not exist or cannot be opened or if the second file cannot be created or opened, copy prints an error message. If the second file already exists, it is overwritten.

Copying directories, devices, fifos and the like are permitted, but are treated differently. Copying a directory just creates the target directory. Copying a device just creates a new device node. Copying a fifo just creates a new fifo.

To copy multiple source files to a target directory: list the source files on the command line followed by the name of the target directory. Copy verifies that the last named file is indeed a directory before attempting the copy or reporting an error.

OPTIONS

-force-hole
    Try to enforce the target filee to be a sparse file. To achive this, copy reads the file in 512 Byte blocks. If a block only contains null bytes, no data is written to the target file. This option works if the filesystem for the target file allows to create sparse files, regardless of the state of the source file.

-i  Interactive. If file type arguments are present, copy will prompt for confirmation whenever the copy would overwrite an existing target. A "y" answer means that the copy should proceed. Any other answer prevents copy from overwriting target. If no file type arguments are present, copy will prompt: From: To: until either a ^C, ^D, or an empty line is typed.

-q  Query. Requests confirmation before each file; "y" or "yes" to do the copy, anything else to skip the file.

-R  POSIX recursive. If the from file is a directory, copy creates not only the target directory but recursively copies all subfiles. If the target directory exists, a directory type from parameter always results in a concatenation of the last path name component of the from parameter and the target directory name.

    If the target directory does not exist in POSIX recursive copy mode and there are only two directory type parameters, the target directory is created and the content of the from directory is copied to the target directory. This is different from the case when the target directory exists.

-r  Recursive. Same as -R but if there are only two directory type path parameters, the content of the from directory will be copied into target directory.

-setowner
    Setowner. Attempts to copy the original user id (only the system administrator can do this).

-setgrp
    Setgroup. Attempts to copy the original group id (only the system administrator can do this).

-s  Attempts to copy both, the owner- ant the group-id of the files (only the system administrator can do this).

-olddate, -o
    Olddate Attempts to copy the original date and time.

-p  Attempt to preserve file permissions, file owner id, file group id and file times. If copy fails to set the owner id or group id on the new file, the permissions S_ISUID and S_ISGID are cleared.

-sparse
    Attempt to preserve holes in sparse regular files. On platforms that support SEEK_DATA and SEEK_HOLE lseek(2) whence values, copy is able to effeciently and correctly restore all hole positions.

-v  Verbose Reports the result of the copy.

NOTES
If the target file does not exist, copy attempts to retain the original user access modes even if -p has not been specified. Copying a device file results in only copying the device file entry, not in reading the device.

When copying an entire directory (using the -r option), the target directory should not exist. Otherwise, a subdirectory with the same name as the source directory is created and used as the destination for all the files.

No slash will be accepted in the interactive mode if the environment variable 'SLASH=off' is set.

BUGS