Category: Linux using 2014-01-14 13:38 1449 people read reviews (0) favorite reports How do I copy a directory under Linux? It seems to be a more satisfactory problem.
For example, to copy/home/usera to/mnt/temp, the first thing I think about is
Cp-r/home/usera/*/mnt/temp
However, there is a problem, the hidden files under the/home/usera will not be copied, the sub-directory of hidden files will be.
What is the right way to do that? Some people say that with the-a option, someone says to use Find to add a pipeline.
In fact, not so complicated, Google, after learning a trick. It turns out only with "." The current directory instead of "*" just fine.
Cp-r/home/usera/. /mnt/temp
# # Update 2013/06/11
If there are already files in '/mnt/temp ', you just want to copy the new files under '/home/usera/', but do not want to overwrite the existing files in '/mnt/temp '? Sort of like merging two directories, right.
To deal with this situation ' CP ' has an option of '-n,–no-clobber ', which is to not overwrite existing files. It should be pretty useful, too.
from:http://www.leonzhang.com/2010/02/03/how_to_copy_folder_in_linux/
Note: Use the-a option to copy hidden files.
How to copy all files in the entire directory under Linux