1

I want to copy all contents in folder A(but not include A itself) to another folder B recursively, and overwrite any existing files or folders with the same name.

Originally I plan to use the following command:

cp -f -r /home/alan/A/* /home/alan/B/

However, after searching online, I find all others recommend the following format:

cp -f -r /home/alan/A/. /home/alan/B/

such as:

How can I copy the contents of a folder to another folder in a different directory
How to copy files from the folder without the folder itself

The strange thing is that I cannot find any official document on this advanced cp command. I tried to use:

man cp
info coreutils 'cp invocation'
cp --help

But none of them indicate such usage. How can I find the official document on advanced cp command and usage?

Thank you very much.

Kevdog777
  • 3,194
  • 18
  • 43
  • 64
alancc
  • 201
  • 1
  • 5
  • Does this answer your question? [cp behaves weirdly when . (dot) or .. (dot dot) are the source directory](https://unix.stackexchange.com/questions/409225/cp-behaves-weirdly-when-dot-or-dot-dot-are-the-source-directory) ... It's not exactly undocumented, it's just not explicitly documented. – muru Mar 10 '20 at 10:48
  • @muru, Thank you very much. It is hard to understand but I finally understand. Thank you very much. – alancc Mar 10 '20 at 11:37

0 Answers0