1e41f4b71Sopenharmony_ci# cp 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ci## Command Function 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ciThis command is used to create a copy for a file. 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci## Syntax 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_cicp [_SOURCEFILE_] [_DESTFILE_] 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci## Parameters 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci **Table 1** Parameter description 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci| Parameter| Description| Value Range| 19e41f4b71Sopenharmony_ci| -------- | -------- | -------- | 20e41f4b71Sopenharmony_ci| --help | Displays help information.| N/A | 21e41f4b71Sopenharmony_ci| SOURCEFILE | Specifies the file to copy.| This command does not support copy of a directory, but supports copy of multiple files at a time.| 22e41f4b71Sopenharmony_ci| DESTFILE | Specifies the file to create.| Both a directory and a file are supported.| 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci## Usage Guidelines 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci- The name of the source file cannot be the same as that of the destination file in the same path. 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci- **SOURCEFILE** must exist and cannot be a directory. 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci- The source file path supports asterisks (*) and question marks (?). The wildcard "\*" indicates any number of characters, and "?" indicates any single character. **DEST** does not support wildcard characters. If the specified **SOURCE** matches multiple files, **DEST** must be a directory. 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci- If **DEST** is a directory, this directory must exist. In this case, the destination file is named after the source file. 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci- If the destination file path is a file, the directory for this file must exist. In this case, the file copy is renamed. 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci- If the destination file does not exist, a new file is created. If the destination file already exists, the existing file is overwritten. 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci> **NOTICE**<br> 40e41f4b71Sopenharmony_ci> When important system resources are copied, unexpected results such as a system breakdown may occur. For example, when the **/dev/uartdev-1** file is copied, the system may stop responding. 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_ci## Example 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ciRun **cp hello-OHOS.txt hello-openharmony.txt ./tmp/**. 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ci## Output 49e41f4b71Sopenharmony_ci 50e41f4b71Sopenharmony_ciCopy **hello-OHOS.txt** and **hello-openharmony.txt** to **/tmp/**. 51e41f4b71Sopenharmony_ci 52e41f4b71Sopenharmony_ci``` 53e41f4b71Sopenharmony_ciOHOS:/$ ls 54e41f4b71Sopenharmony_cibin hello-OHOS.txt proc system vendor 55e41f4b71Sopenharmony_cidev hello-openharmony.txt sdcard userdata 56e41f4b71Sopenharmony_cietc lib storage usr 57e41f4b71Sopenharmony_ciOHOS:/$ mkdir tmp 58e41f4b71Sopenharmony_ciOHOS:/$ cp hello-OHOS.txt hello-openharmony.txt tmp/ 59e41f4b71Sopenharmony_ciOHOS:/$ ll tmp 60e41f4b71Sopenharmony_citotal 0 61e41f4b71Sopenharmony_ci-rwxrwxrwx 1 0 0 0 1979-12-31 00:00 hello-OHOS.txt* 62e41f4b71Sopenharmony_ci-rwxrwxrwx 1 0 0 0 1979-12-31 00:00 hello-openharmony.txt* 63e41f4b71Sopenharmony_ci``` 64