Add PreserveAttributes flag to copy function to preserve file attributes (issue 11434) and current behavior (not at the same time)

Avoid compiler errors from new versions

rename flag

add documentation and spaces