ls -al ../public-back
drwxrwxr-x  4 apache   apache     4096 Apr 19 03:32 templates

ls -al ../public-back/templates

drwxrwxr-x  2 apache   apache    4096 Apr 19 03:33 content
drwxrwxr-x  2 apache   apache   20480 Apr 20 06:14 images
drwxrwxr-x  2 apache   apache    4096 Apr 19 03:35 video

ls -al /public

drwxrwxr-x  4 apache   apache     4096 Apr 20 09:49 templates

ls -al /public/templates

drwxrwxr-x  2 apache   apache    4096 Apr 20 09:50 content
drwxrwxr-x  2 apache   apache    4096 Apr 20 09:50 images
drwxrwxr-x  2 apache   apache    4096 Apr 20 09:50 video

How do I move the contents of /public-back/templates recursively with permissions into /public/templates ?

link|improve this question
mv ../public-back/templates/* public/templates/ – Vlad Khomich Apr 20 '11 at 10:28
mv -R ../public-back/templates/* public/templates/ I'd still vote to move the question. – Vladislav Zorov Apr 20 '11 at 10:33
mv: invalid option -- R @Vladislav Zorov – Frank D Apr 20 '11 at 11:12
i did cp -a ../public-back/templates/ public/ – Frank D Apr 20 '11 at 11:20
feedback

migrated from stackoverflow.com Apr 20 '11 at 13:56

This question came from our site for professional and enthusiast programmers.

2 Answers

Unless I am misunderstanding the question wouldn't this work?

mv /public-back/templates/* /public/templates

also, unless you have a huge list of files adding -i will ask before it overwrites anything, which add some safety when using wildcards like *.

link|improve this answer
feedback

The man page for cp states:

-p same as --preserve=mode,ownership,timestamps
-r same as --recursive=copy directories recursively

Try;

cp -rp /public-back/templates/* /public/templates/
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.