I use the following command to copy data and it is working as expected.

cp -pr --reply=yes /db-nfs/mysql3/* /db-nfs/mysql5/

1) Is there a better way?

2) I want to copy the same data to /db-nfs/mysql7 as well. Is it possible in single command?

link|improve this question

feedback

2 Answers

up vote 0 down vote accepted

If you are repeatedly copying the same data over to the folders rather than a one time copy to a blank target, consider using rsync instead:

rsync -av /db-nfs/mysql3/ /db-nfs/mysql5/
rsync -av /db-nfs/mysql3/ /db-nfs/mysql7/

(Note the trailing slashes are important!)

link|improve this answer
feedback

1) This won't preserve hard links and extended attributes, so you may be better off using -a instead of -p.

2) Depends what you mean by a single command! You could write a script which runs multiple cp commands and then that script itself would be a single command.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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