Examples of copying directories with the cp command

To create a new copy of a directory:

   cp -r draft presentation

This copies all the files and subdirectories in the directory draft into a new directory presentation.

You try to create a copy of a directory using the name of directory that already exists:

   cp -r planA projects

If the directory projects already exists, then a copy of the directory planA will be created in this directory.

[Home] [Search] [Index] This site maintained by unixhelp@ed.ac.uk