Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using the following to recursively copy a directory while preserving modes, permissions as well as hard and symbolic links:

cp -pr --preserve=links dir-a dir-b

However I have the following problems with the above:

  1. the man page for cp is not explicit on what happens if both -p and --preserve are specified. In my bash the effect of both is applied but I don't know how portable this is.
  2. the man page for cp is not clear on what "links" means when given as an argument to --preserve. Hard, symbolic or both? In my bash it's both which is what I want, but again it is not explicitly stated
  3. The command is long and not easily typed and I don't want to add too many aliases.

Are there any other idioms that you use for the above?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.