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?

link|improve this question

48% accept rate
feedback

2 Answers

up vote 6 down vote accepted

try

cp -r wordpress/* /my/folder
link|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
4  
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
feedback

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)

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.