1

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?

0

You must log in to answer this question.

Browse other questions tagged .