Copy entire folder in Linux

To copy an entire folder (directory tree) in Linux, use the following method:
mkdir target_directory
cd source_directory
cp -ap . target_directory

Other options:
cp -apv . target_directory (for verbose results)
\cp -ap . target_directory (for unix)
More info:
linuxguide.sourceforge.net

4 Replies to “Copy entire folder in Linux”

  1. better explanation would be:
    mkdir target_dir
    cd source_dir
    cp -ap . /path/to/target_dir
    mkdir : makes directory
    cd : goes to a directory
    cp : command for copy
    -ap : cp options for copying files/folders with the same attributes/permissions…
    . : stands for all files/folders

Leave a Reply

Your email address will not be published. Required fields are marked *

Please answer question below to verify that you are a real person *