-1

I need to copy a directory and its content to a NEW directory.

Using: cp -r dir1/dir2 dir1/dir3 where dir3 is going to be created anew, it just copies the file(s) I have within dir2... It's like it copies dir2 naming it dir3. Is there any way to copy dir2 into dir3?

I need to do it with a single command.

Da Real Pope
  • 1
  • 1
  • 1
  • "Using a single command with options, copy the `play` directory in the `practice1` directory to a new directory in the `practice1` directory called `appointments`." – Da Real Pope Nov 17 '14 at 21:49

1 Answers1

1

It's not really possible to do it in 1 command with cp. What you want is for dir3 to already exist when you do your copy. I'm not sure if there's a real reason why you have to do it in 1 command or not. You can certainly do it in one line.

mkdir dir/dir3;cp -r dir1/dir2 dir1/dir3

Mike
  • 359
  • 1
  • 3