"Linux" copies folder contents to another folder

Source: Internet
Author: User

I always thought CP was a very simple instruction. It turned out to be a pit. Record it.

Folder 1:test1/

Folder 2:test2/

Target: Copy all files and directories in the test1/to test2/

Correct instruction:

CP -RF test1/. test2/

Note that the back of the test1/is a point

The following command is problematic:

CP -RF test1/*  test2/

I have been using this sentence, the results found today, if Test1 is an empty folder, the command will error. But if you replace the *. There is no problem at all.

"Linux" copies folder contents to another folder

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.