Execute CP command prompt under CentOS Skip folder

Source: Internet
Author: User

Today when copying a folder to another folder, CP./res/usr

When there is a problem, I am prompted by:

CP skipped the folder

And then I looked for a bit.

Search The web for the use of the CP command:


CP Command


the function of this command is to copy the given file or directory to another file or directory , with lang= Word-wrap:normal; Word-break:normal the >copy command, the functionality is very powerful.  
" syntax "  CP [ Option   source file or directory destination file or directory  
" description " This command copies the specified source files to the destination file or copies multiple source files to the destination directory.
" meaning "

< Span lang= "en-US" style= "word-wrap:normal; Word-break:normal ">

-a   This option is typically used when copying a directory. It retains links, file attributes, and recursively copies the directory, which is equal to DPR option combination. to preserve file attributes when copying with -a , otherwise it will cause problems such as the service cannot be applied, such as the original file owner is oracle , direct CP after the file owner becomes root , which causes the database server to become unusable, you can use chown to modify the file owner, or copy the time directly with cp-a command )

- Keep links when copying D.

-F Delete a target file that already exists without prompting.

< Span lang= "en-US" style= "word-wrap:normal; Word-break:normal ">-i   and f option opposite , a prompt is given before overwriting the target file to require user confirmation. Answer y when the target file will be overwritten, is an interactive copy.

< Span lang= "en-US" style= "word-wrap:normal; Word-break:normal ">-p   at this time CP In addition to copying the contents of the source file, its modification time and access rights are also copied to the new file.  

-R If the source file is a directory file, the CP will recursively replicate all subdirectories and files in that directory. At this point the target file must be an item

Record name.

-L do not make copies, just link files.
need toDescriptionis, in order to prevent users inadvertently with the CP command to destroy another file, such as the user specified target file name already exists, with the CP command to copy the file, the file will be overwritten by the Xinyuan file, therefore, the user is recommended to use the CP command, it is best to use the I option when copying a file.
Example:

cp-i file1 file2(Copy the document file1 to file2. –I for prompt confirmation )
cp file1 dir1    (Copy document file1 to directory dir1 , file name is still file1)
Cp/tmp/file1.    (Copy the document file1 under directory/ TMP to the current directory, the file name is still file1)
cp/tmp/file1 file2 ( file1 The document under the directory/ TMP under the current directory, with the file name file2
cp-r dir1 dir2 (recursive copy) Copy the entire directory . If the directory Dir2 does not exist, the directory Dir1, and all of its documents and subdirectories, are copied to the directory Dir2 , and the new directory name is dir1. If the directory Dir2 does not exist, the Dir1, and all of its documents and subdirectories, are copied to the directory Dir2)


Execute CP command prompt under CentOS Skip folder

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.