When I use -p to preserve the file permissions of a file being copied, does it apply to the source or the destination file (if it already exists)?

Thanks

link|improve this question

73% accept rate
feedback

1 Answer

up vote 4 down vote accepted

It's preserves the source file's attributes (mode, ownership, and timestamps) in the destination. (Provided the destination file system supports it.)

If a file already exists it will be overwritten with the source and it's attributes, unless you've combined the -i flag.

link|improve this answer
exhausting and 100% correct. – yarek Jan 19 at 22:11
So if -p is not specified and the destination file exists, the copied file will inherit the mode and owner of the existing file? – Tom Jan 19 at 23:02
Yes, that's correct. :) – Aaron Copley Jan 20 at 22:35
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.