Solaris Advanced User's Guide

Copying Directories

Use the cp -r command to copy directories and the files they contain:

$ cp -r veggies veggies3

The command in the previous example copies all files and subdirectories within the directory veggies to a new directory veggies3. This is a recursive copy, as designated by the -r option. If you attempt to copy a directory without using this option, the system displays an error message.