9

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?

2 Answers 2

14

try

cp -r wordpress/* /my/folder
3
  • hm....case senstivity :) what does the -r do?
    – user27449
    Commented Nov 27, 2010 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
    Commented Nov 27, 2010 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
    Commented Nov 27, 2010 at 5:57
2

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)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .