Hitachi

JP1 Version 11 JP1/Advanced Shell Description, User's Guide, Reference, and Operator's Guide 


8.4.5 cp command (copies files or directories)

Syntax

cp [-f|-i] [-p] [-u] [-R|-r [-H|-L|-P]] copy-source-file-name copy-target-file-name
cp [-f|-i] [-p] [-u] [-R|-r [-H|-L|-P]] copy-source ... copy-target-directory-name

Description

The command copies files or directories.

Arguments

-f

--force

This command does not issue warning when the file at the destination is overwritten. If the -f and -i options are both specified, the option specified last takes effect.

-i

--interactive

This command specifies that when the file at the destination is overwritten, a warning is to be issued asking the user to respond. Copying is performed if the response from the standard input begins with the letter y or Y. If the response begins with any other character, or if the standard input is not available, processing is interrupted and the command terminates with a return code of 0.

If the -f and -i options are both specified, the option specified last takes effect.

-p

--preserve

This command saves the attributes of the source file.

In Windows, the last modified date and time and the last access date and time of each source file are retained. Directory information is not retained.

In UNIX, the owner, group, access permissions, last modified date and time, and last access date and time of each source file are retained.

-u

--update

This command specifies that copying is to not be executed when the destination file already exists and the last modified date and time are the same as or later than those of the source when copying a file other than directory.

When copying a symbolic link, whether to copy the symbolic link is determined based on the last modified date and time if the destination is a symbolic link. If the destination is a file, whether to copy the symbolic link is determined based on the last modified date and time of the destination file.

The last modified date and time of a file is determined upon rounding off values smaller than a second.

-R|-r

--recursive

This command recursively copies a directory.

In Windows, the directory delimiter at the end is ignored even if you specify the symbolic link to the directory having the directory delimiter at the end for the copy source. To copy the directory of the link destination of the symbolic link, specify this option along with the -H or -L option.

-H

This command follows the symbolic link specified in the command line when this option is specified together with the -R option or -r option.

This command does not follow symbolic links encountered while traversing the tree.

This option is applied to the source.

This option is ignored if either the -R or -r option is not specified. If more than one of the -H, -L, and -P options are specified, the option specified last takes effect.

-L

--dereference

If this option is simultaneously specified with the -R or -r option, the command follows all symbolic links that are encountered.

This option is applied to the source.

This option is ignored if either the -R or -r option is not specified. If more than one of the -H, -L, and -P options are specified, the option specified last takes effect.

-P

--no-dereference

If this option is simultaneously specified with the -R or -r option, the command does not follow any symbolic links.

This option is applied to the source.

This option is ignored if either the -R or -r option is not specified. If more than one of the -H, -L, and -P options are specified, the option specified last takes effect.

copy-source-file-name

This command specifies the name of the file to be copied.

copy-target-file-name

This command specifies the name of the file at the destination.

copy-source

This command specifies the file or directory to be copied.

copy-target-directory-name

This command specifies the directory to be copied.

Return codes

Return code

Meaning

0

Normal termination

1 or greater

Error termination

Notes

Examples