1 Star 0 Fork 4.9K

mayongdong / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
cp.md 4.18 KB
一键复制 编辑 原始数据 按行查看 历史
NEEN 提交于 2021-03-12 17:59 . !197 Docs Update version 1.0.1

cp

Command Function

This command is used to create a copy for a file.

Syntax

cp [SOURCEFILE] [DESTFILE]

Parameter Description

Table 1 Parameters

Parameter

Description

Value Range

SOURCEFILE

Indicates the path to the source file.

Currently, only files are supported. Directories are not supported.

DESTFILE

Indicates the path to the destination file.

Both directories and files are supported.

Usage

  • The name of the source file cannot be the same as that of the destination file in the same path.
  • The source file must exist and cannot be a directory.
  • The source file path supports wildcards: asterisks (*) and question marks (?). The asterisk (*) indicates any number of characters, and the question mark (?) represents a single character. The destination file path does not support wildcards. If the specified source file path matches multiple files, the destination file path must be a directory.
  • If the destination file path is a directory, this directory must exist. In this case, the destination file is named after the source file.
  • If the destination file path is a file, the directory for this file must exist. In this case, the file copy is renamed.
  • Currently, this command can be used to copy only one file. If more than two parameters are specified, only the first two parameters take effect.
  • If the destination file does not exist, a new file is created. If the destination file already exists, the existing file is overwritten.

When important system resources are copied, unexpected results such as a system breakdown may occur. For example, when the /dev/uartdev-0 file is copied, the system may stop responding.

Example

Enter cp hello-harmony.txt ./tmp/.

Output

Figure 1 File copying result

1
https://gitee.com/mayongdongsmile/docs.git
git@gitee.com:mayongdongsmile/docs.git
mayongdongsmile
docs
docs
master

搜索帮助