Thursday, May 2, 2024
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 9969  / 2 Years ago, thu, april 28, 2022, 12:41:25

When I copy files from one directory to another, the directory permissions get reset (e.g: from 0755 to 0775), and this causes problems, forcing me to go back and manually reset directory permissions. I'm currently doing cp -r /source/directory /destination/directory



I want to copy all of the files and new directories, but not overwrite permissions of existing directories.


More From » command-line

 Answers
3

To preserve links you may use cp (manpage for cp ) with the -d flag, which is equivalent to --no-dereference --preserve=links.



To combine this with the -p and -R flags you can use the archive flag -a.


[#29953] Friday, April 29, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
montwim

Total Points: 103
Total Questions: 112
Total Answers: 120

Location: Vietnam
Member since Mon, Mar 14, 2022
2 Years ago
montwim questions
;