Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

You must log in to answer this question.

Browse other questions tagged .