Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
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 ?

share|improve this question

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

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

    
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

2 Answers 2

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 *.

share|improve this answer
    
+1 This answer should be accepted. –  I Like to Code Apr 23 at 20:22

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/
share|improve this answer
2  
mv is for move, while cp is for copy – a semantical/etymological distinction. –  Marius Butuc Mar 19 '13 at 17:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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