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.

I want to copy the contents of an unzipped folder, wordpress/, to another existing folder.

I tried

cp -R wordpress/*.* /my/folder

but the sub-folders in wordpress/ didn't get copied over.

Why not?

share|improve this question

2 Answers 2

up vote 13 down vote accepted

try

cp -r wordpress/* /my/folder
share|improve this answer
    
hm....case senstivity :) what does the -r do? –  user27449 Nov 27 '10 at 3:06
    
This is weird. I just tested ur command line. It also works. According to the manpages, -r Copy file hierarchies and the treatment of special files is implementation-defined. While -R is more versatile. pwet.fr/man/linux/commandes/posix/cp –  wliao Nov 27 '10 at 3:24
6  
MORE PERTINENTLY: There's a different ARGUMENT being provided; wordpress/*.* is NOT the same as wordpress/* - subfolders didn't get copied with . because the folder names do not include the character "." in them. –  pbr Nov 27 '10 at 5:57

If you have hidden files/directories then you'll need to run the following from inside the source directory

tar pcf - .| (cd /path/to/destination; tar pxf -)

that will copy all files and folders including ones starting with a . (dot).

If you don't have hidden files/directories that need to be copied then wliao's answer will do.

(edited for clarity)

share|improve this answer

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.