Run the cp command in Centos to indicate that the folder is skipped.

Source: Internet
Author: User

Run the cp command in Centos to indicate that the folder is skipped.

When copying a folder to another folder today, cp./res/usr

When a problem occurs, the prompt is:

Cp skipped the folder

Then I looked for it.

I searched the internet for the usage of the CP command:


CP command


This command is used to copy the given file or directory to another file or directory. It is very powerful like the copy command in MSDOS.
[Syntax] cp [Option] source file or directory target file or directory
[Note] This Command copies the specified source file to the target file or multiple source files to the target directory.
[Description]


-A this option is usually used when copying directories. It retains links and file attributes, and Recursively copies directories. Its role is equal to the combination of dpR options. (When copying a file, you must retain the file attributes with-a. Otherwise, the Service may fail to be applied. For example, if the original file owner is oracle, the file owner changes to root after cp, the database server may be unavailable. You can use chown to modify the file owner, or use the cp-a command to copy the file)

-D: the link is retained during copy.

-F delete an existing target file without prompting.

-I and f options are opposite. A prompt is displayed asking the user to confirm before overwriting the target file. When the answer is y, the target file will be overwritten, which is an interactive copy.

-P in addition to copying the source file content, cp also copies the modification time and access permissions to the new file.

-If the source file provided by r is a directory file, cp will recursively copy all subdirectories and files in the directory. The target file must be

Name.

-L do not copy, but only link files.
It should be noted that, in order to prevent the user from using the cp Command inadvertently to destroy another file, such as the target file name specified by the user already exists, use the cp command to copy the file, this file will be overwritten by the new source file. Therefore, we recommend that you use the I option when using the cp command to copy the file.
Example:

Cp-I file1 file2 (copy file file1 to file2.-I for Prompt confirmation)
Cp file1 dir1   (Copy the file file1 to the directory dir1, and the file name is still file1)
Cp/tmp/file1. (Copy the file file1 under the/tmp directory to the current directory, and the file name is still file1)
Cp/tmp/file1 file2(In the current directory of file1 under/tmp, the file name is file2.
Cp-r dir1 dir2    (Recursive copy) copies the entire directory. if the directory dir2 does not exist, copy the directory dir1 and all its documents and subdirectories to the directory dir2. The new directory name is dir1. if the directory dir2 does not exist, dir1, and all its documents and subdirectories, copy to the directory dir2)


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.