9

How can I do a cp to copy all files including all sub-directories in the current directory.

I looked at the man page, but I can't figure out how to do it.

EDIT: (my *nix is Linux)

2 Answers 2

26

What *nix do you have?

Under Linux you use normally:

cp -r <source> <target>

and if you want to copy all the same attributes (aka owner, etc.):

cp -a <source> <target>
2

cp -r dir1 dir2

-R, -r, --recursive
          copy directories recursively
1
  • Sorry, tell me if I'm wrong but, it will copy all subdirectories recursively ? So it'll copy all the files located in them in my current directory ? Nov 29, 2013 at 7:47

You must log in to answer this question.

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