1

I use terminal/the command line on a daily basis for front end web development.

As an example: Today, from the command-line I was trying duplicate a project to make a responsive web page design from a non-responsive template I had created. I know you can use cp -a /source/. /dest/ like shown here to copy files but it isn't quite duplication.

Instead of copying; inside of directory X I wanted to duplicate directory A so I have directory A and directory A(1) side by side.

I know I could quickly do this in the GUI but for the sake of a streamlined workflow I got curious.

So, would copying (cp) the directory to the same folder accomplish the same thing or this also void?

Is direct duplication at the command-line not possible or is there a certain way you have to go about it?

Thanks.

1 Answers1

2

You can do it simply:

cp -r path/to/original/dir1 path/to/original/newdir1

e.g: directory_A1 does not exist but is created when specified in the command:

cp -r /home/me/Documents/directory_A /home/me/Documents/directory_A1

If you want 'directory_A(1)': Surround the second path in quotes.

cp -r /home/me/Documents/directory_A "/home/me/Documents/directory_A(1)"
gentooza
  • 118