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:
- 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.
- 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
- 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?