O'Reilly logo

Mac OS X Tiger in a Nutshell by Jason McIntosh, Chuck Toporek, Chris Stone, Andy Lester

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

cp

Synopsis

cp [options] file1 file
cp [options] files directory

Copies file1 to file2, or copies one or more files to the same names under directory. If the destination is an existing file, the file is overwritten; if the destination is an existing directory, the file is copied into the directory (the directory is not overwritten). If one of the inputs is a directory, uses the -R option.

cp doesn't preserve resource forks or HFS metadata when copying files that contain them. For such files, use CpMac or ditto instead.

Options

-f

Remove the target file, if it exists, before creating the new copy. Also, don't prompt for confirmation of overwrites. Overrides previous -i or -n options.

-H

If any of the pathnames given in the command line are symbolic links, follow only those links during recursive operation. Works only with the -R option.

-i

Prompt for confirmation (y for yes) before overwriting an existing file.

-L

Follow all symbolic links during recursive operation. Works only with the -R option.

-n

Doesn't overwrite existing target file. Overrides previous -f or -i options.

-p

Preserve the modification time and permission modes for the copied file. (Normally cp supplies the permissions of the invoking user.)

-P

Follow no symbolic links during recursive operation. Works only with the -R option (the default).

-R

Recursively copy a directory, its files, and its subdirectories to a destination directory, duplicating the tree structure. (This option is used with the second command-line ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required